LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   cron is ignoring lines... (https://www.linuxquestions.org/questions/linux-software-2/cron-is-ignoring-lines-717415/)

true_atlantis 04-07-2009 08:08 AM

cron is ignoring lines...
 
My current crontab looks like:

[root@sda03 ~]# crontab -l
0 0,8,16 * * * /opt/CMTSCheck/bin/GrabCMData.sh
37 * * * * /opt/CMTSCheck/bin/RegStateUpdate.sh
1 1 * * * /opt/CMTSCheck/bin/DropOldTables.sh

For some reason, the only thing that will execute is the middle line... Any idea why?

[root@sda03 ~]# grep GrabCMData /var/log/cron | wc -l
0
[root@sda03 ~]# grep DropOldTables /var/log/cron | wc -l
0

This is on a RH5.1 system with crontabs-1.10-8 installed.

Am I doing something wrong?

synss 04-07-2009 01:04 PM

Are all of them executable? Check with ls -l.

colucix 04-07-2009 02:01 PM

Any message in the mail box of the crontab's owner?

true_atlantis 04-09-2009 05:27 AM

Yes, they are all executable, and exist. There are no messages in the crontabs mailbox...

[root@sda03 ~]# ls -lah /opt/CMTSCheck/bin/GrabCMData.sh
-rwxr-xr-x 1 501 20 1.2K Apr 6 13:51 /opt/CMTSCheck/bin/GrabCMData.sh
[root@sda03 ~]# ls -lah /opt/CMTSCheck/bin/RegStateUpdate.sh
-rwxr-xr-x 1 501 20 1.8K Mar 31 22:00 /opt/CMTSCheck/bin/RegStateUpdate.sh
[root@sda03 ~]# ls -lah /opt/CMTSCheck/bin/DropOldTables.sh
-rwxr-xr-x 1 root root 524 Mar 30 15:41 /opt/CMTSCheck/bin/DropOldTables.sh

colucix 04-09-2009 05:35 AM

What about redirecting standard output and standard error to a file? Put the current date in the filename so that you know when the file has been created and if the cron job has run at the proper time:
Code:

0 0,8,16 * * * /opt/CMTSCheck/bin/GrabCMData.sh > /opt/$(date +\%Y\%m\%d\%H\%M)_GrabCMData.log 2>&1
37 * * * * /opt/CMTSCheck/bin/RegStateUpdate.sh > /opt/$(date +\%Y\%m\%d\%H\%M)_RegStateUpdate.log 2>&1
1 1 * * * /opt/CMTSCheck/bin/DropOldTables.sh > /opt/$(date +\%Y\%m\%d\%H\%M)_DropOldTables.log 2>&1



All times are GMT -5. The time now is 07:33 PM.