Can anyone spot the error in this cron file?
I have the following crontab -l output
01 12 * * * /home/jeff/logmail.sh 01 18 * * * /home/jeff/logmail.sh And the logmail.sh file looks like this #!/bin/bash # mail iluvspam@aol.com < /var/log/maillog cat /dev/null > /var/log/maillog #end And it doesn't work. I can run the script manually and it works like a charm, so I know it is not the script. What is wrong with the cron file? :scratch: |
the only thing that could possibly be wrong with that, is if that file maillog is only allowed to be accessed by root and your running this script as user....otherwise your syntax is fine and it should work no problem
|
actually just to note:
why don't you post the error you get when you run the script if any. |
There is no error. When I run the script it works like a champ. When cron runs it nothing happens. Wierd. I am trying to use webmin now to set up the cron job. Maybe I missed something doing it by hand..
|
Quote:
Code:
MAILTO=username Also, by default, on some distributions cron is disabled for regular users, and the cron daemon is not even started. Doublecheck and see if some sort of a cron daemon is running. For example on my system you'd see the following: Code:
[rouben@einstein rouben]$ ps ax | grep cron Don't bother with Webmin; your syntax is fine. P.S. You did use crontab -e to edit your crontab, did you? |
I run this as root. If I manually execute the script (bash logmail.sh) it sends me a message from root with the contents of the log exactly as I wanted it. I ran a "PS -A" and crond is running. I did use crontab -e. When I type crontab -l it lists the cron jobs as shown in my first post.
I will let it run tonight as the next schedualed occurance is at 6pm (it's 4 now) and see if it goes.. Do I need to restart crond each time I make a change? |
I dunno, check the permissions....
|
All times are GMT -5. The time now is 04:40 AM. |