LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Yet another problem with CRON (https://www.linuxquestions.org/questions/linux-general-1/yet-another-problem-with-cron-944563/)

Eisenhorn 05-12-2012 07:38 AM

Yet another problem with CRON
 
Hi,
I know there a lot of threads discussing cron, but still these didn't help to solve my problem.
I have a script named ciscal which is located in /etc/cron.hourly.
Unfortunately this script wont execute. Thats what the command
Code:

tail -200  /var/log/syslog | grep CRON
says

Code:

May 12 13:39:01 localhost /USR/SBIN/CRON[16000]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete)
May 12 13:39:01 localhost /USR/SBIN/CRON[15998]: (root) END (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete)
May 12 14:01:01 localhost /USR/SBIN/CRON[16507]: (root) CMD (run-parts /etc/cron.hourly)
May 12 14:01:06 localhost /USR/SBIN/CRON[16506]: (root) END (run-parts /etc/cron.hourly)

The name should be ok, as I have read that .sh can cause troubles. I can see that cron executes at the deisred time but the script is not executed, altough
Code:

run-parts --test /etc/cron.hourly
/etc/cron.hourly/ciscal

says it would do so.

Persmissions look like this
Code:

-rwxr-xr-x  1 root root    66 May 12 10:56 ciscal
so this should do fine.
The script itself looks like this
Code:

#!/bin/bash
echo "Test" > output
/usr/local/sbin/rubyscripts/cal

If I start it manually it works just fine. I really dont have any clue anymore.
Ah the cronttab looks like this
Code:

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

#SHELL=/bin/sh
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/

# m h dom mon dow user  command
#17 *  * * *  root    cd / && run-parts --report /etc/cron.hourly
01  *  * * *  root    run-parts /etc/cron.hourly
25 6    * * *  root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7  root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *  root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

BR

pan64 05-13-2012 12:39 AM

I would rather write (in ciscal) echo "Test" > /full/path/to/output, and check that file. Also there can be a problem with the file /usr/local/sbin/rubyscripts/cal.


All times are GMT -5. The time now is 12:39 PM.