[Tutor] Python script to automatically send mails (running as acron job in cygwin/linux)

Alan Gauld alan.gauld at blueyonder.co.uk
Thu Nov 20 16:33:31 EST 2003


> I need to write a python script which would run through 
> a cron job in cygwin/linux. 

That's pretty straightforward cron setup.

> I need the script to authenticate itself 

In what way? The script knows itself, so against what is it 
authenticating? The user id? Some digitally signed data?
A digitally signed version of itself (to ensure it hasn't 
been tampered with)?

We need a tad more info here.

> and send the mail. 

What mail?
cron will send email to signal its status.
Do you want your job to send another mail? To which user?
Containing what?

> The script needs to read my account info (host, login 
> and password) from some encrypted file. 

OK, Python provides standard modules for encrypting files 
in a variety of formats. Depends what level of encryption 
you want to use.

> especially how I can store my login information in a 
> secure, encrypted format and have my script read it.

Provided you use the same encryption/decryption technique its
fairly painless. Just pack the data into a string, encrypt it and 
write the result to a standard text file. To read it, open the 
file, read the whole file back as a string. Unencrypt it and 
unpack the data.

Does that help?  Or do you have any more specific questions?

Alan G.





More information about the Tutor mailing list