Technical Forum
Ask questions. Discover Answers.
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

Strange question Cron problems


So I have this strange problem. I have been having trouble with one of my F5s that is in a remote location. I wrote a quick script to check temp and email if it is high. So if I run it command line it works fine. Basically it checks, emails me and next time it runs it checks to see if there are any new temp alerts. So it works fine if I just run the script. But I am having trouble with it running as a cron job? If I run mailx as root it sends a message. What would be different if running as a cron. And how would I log it to see errors? Thanks Joe



Can you paste a copy of your cron configuration?



Josh, That would probably help right? I have been trying it every way I can think of. Each time I change it I run /etc/init.d/crond restart Not sure if I have to but it can't hurt right.

 cron tab for root
1-59/10 * * * * /usr/bin/diskmonitor
0 */4 * * * /usr/bin/diskwearoutstat
50 20 * * * /usr/bin/updatecheck -a
50 20 21 * * /usr/bin/phonehome_activate
*/5 * * * * /home/Joe/
 block 395320 

*/1 * * * * /usr/sbin/lsusb -v -d 0451:3410 >/dev/null
 end 395320 
54 * * * * /usr/bin/copy_rrd save

It is the /home/Joe/ have also tried running it like

*/5 * * * * /etc/cron.hourly/

As well as

*/5 * * * * root /etc/cron.hourly/
*/5 * * * * /home/admin/
*/5 * * * * root /home/admin/

The script has to write a file locally and it can't seem to write it in cron.hourly so I keep moving it around. So the script runs a grep and writes a file. When it is in my home directory or home/admin it does the grep and writes the file but doesn't email it. If I copy the command out of the script and run it it will email the file as me or as root? Probably something stupid but I am stumped... Thanks for your help. Joe

Sounds like a crontab PATH environment problem. In this post you'll find some tips on how to verify that this is indeed the cause of your problems and how to fix it.

Restarting the crond shouldn't be necessary. Just make sure you use the

crontab -e
command to edit the crontab and verify your changes with
crontab -l


Hey Joe, Hope you are doing well. Can you please help sharing your temperature script here. this would be really helpful for me & even other users. Thank you.