samedi 27 juin 2015

Checking mail subject from Bash or Python

I have many cron jobs running on various servers, I want to check the status of the jobs via mail using command line. The only way seems to me is to extract the subject or body of the mail the jobs sent. cron will send mail regardless of the success or failure.

For example, upon success cron will send a mail with subject:

Done..succeeded

If failed:

Not done..Failed

The cron jobs run at specific times e.g. lets take 10:00, 16:00 and 22:30 everyday.

I have tried curl and urllib2 but could not get desired result. Also note that i can not make any modification to cron itself, the only option is to check the gmail.

So how can i check my gmail from bash or python to extarct the subject so that i get get an idea of the cron job?

Aucun commentaire:

Enregistrer un commentaire