On Monday 27 Feb 2012, Amit Sharma wrote: > #!/bin/bash > # Script to check exim mailq at a specified interval > echo `date` >> /adminscripts/logs/eximcount > echo `exim -bpc` >> /adminscripts/logs/eximcount
First of all, why the needless complexity? You can just: date >> /adminscripts/logs/eximcount exim -bpc >> /adminscripts/logs/eximcount Also, should the first >> be a single > ? > if [ `exim -bpc` -gt 0 ] > then > cat /adminscripts/logs/eximcount |mail -s "Count of EXIM Mailq > on Server" a.sha...@example.com else > exit 1 > fi > > The above runs fine manually, however when I try to run it through > crontab (as root), it DOES run but /adminscripts/logs/eximcount gets > empty value. When I run it manually it is able to get the correct > count like 5, 10 etc. > What am I missing here? Please help. Check the permissions on the script. Remove the file before the cron runs and see if it gets created. Check where root's mail goes -- that will help you track any cron errors. Put full paths to all programs you execute in the script. Let us see the whole cron command line. Regards, -- Raj -- Raj Mathur || r...@kandalaya.org || GPG: http://otheronepercent.blogspot.com || http://kandalaya.org || CC68 It is the mind that moves || http://schizoid.in || D17F _______________________________________________ Ilugd mailing list Ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd