Results 1 to 2 of 2
Dear Linux Expert,
I have created a cornjob for taking backup of some important directories. Can you please tell me how to configure the cronjob such that when every their ...
- 11-24-2009 #1Just Joined!
- Join Date
- Dec 2008
- Location
- chandigarh
- Posts
- 29
Cronjob failure noticefication via email
Dear Linux Expert,
I have created a cornjob for taking backup of some important directories. Can you please tell me how to configure the cronjob such that when every their is failure of any cronjob then it should send me a mail or should email me the success and faliure notice of every cronjob in implemented on the root user
30 11 * 6 * /usr/lib/tar -czf /backup/data.tar.gz /data
30 11 * 6 * /usr/lib/tar -czf /backup/data1.tar.gz /data1
30 11 * 6 * /usr/lib/tar -czf /backup/data2.tar.gz /data2
Now i want if any one of the above cronjob fails then it should send me a mail on gobind@abc.com
and need success status too of jod on the same email address.
And is this configuration is different for other local user? If yes , then please tell me

Please help me.
- 11-25-2009 #2Just Joined!
- Join Date
- Oct 2008
- Posts
- 31
30 11 * 6 * /usr/lib/tar -czf /backup/data.tar.gz /data || /usr/bin/mailx -s "Job Failed" address@foo.foo
That would work... If it was me though I would write a script and have cron run that instead. Only because its easier to make a script to an advanced function.
**edit** And i am sure those jobs will fail everytime as I have never seen the tar binary exist in /usr/lib, heh


Reply With Quote