Categories
Linux Mastering Development Ubuntu

Mail transmits when script run manually but fails as a cron job

I have a script space_monitor.sh which when ran, will check the used and available disk space in a machine and if the space left is less than a threshold, it will send mail to some mail ids.

The script is running perfectly when I ran through command line.

But when I run it by creating a cron job. It is giving the following error

Mar 27 01:38:01 gudiwadap-udt cron[1497]: (ram) RELOAD (crontabs/ram)
Mar 27 01:38:01 gudiwadap-udt CRON[17802]: (ram) CMD (/home/ram/Desktop/Untitled_Folder/space_monitor.sh)
Mar 27 01:38:07 gudiwadap-udt sSMTP[17814]: RCPT TO:<ram@gudiwadap-udt.india.tejasnetworks.com> (550 5.7.1 Unable to relay)
Mar 27 01:38:07 gudiwadap-udt CRON[17801]: (ram) MAIL (mailed 1 byte of output; but got status 0x0001, #012)

I tried googling about this, but I could not find any issue online which matches my case.

The crontab entry for the script is

38 00-18 * * 1-5 /home/ram/Desktop/Untitled_Folder/space_monitor.sh

If I am not wrong, above cron job will run every weekday(mon to fri) for every hour from 00 to 18hrs exactly during 38th minute of the hour.

I was even specifying absolute paths to binaries such as echo, mail.
I am not able to figure out what I am doing wrong.

EDIT
System Details : Ubuntu Desktop 14.04

Leave a Reply

Your email address will not be published. Required fields are marked *