Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a script listed in my roots crontab

07 9 * * * /opt/HLRSDATA_2010_OCT/HLRS_Scheduler_sp.sh > /opt/HLRSDATA_2010_OCT/logs/HLRTKJob.log

This script contains the following

#!/bin/bash
echo HLRSData Scheduler
cd /opt/HLRSDATA_2010_OCT
/usr/bin/java -Xms32m -Xmx1024m -cp ".:HLRSDATA_Premium.jar:lib/commons-net-1.4.1.jar:lib/jakarta-oro-2.0.8.jar:lib/mysql-connector-java-3.1.12-bin.jar:lib/x
ercesImpl.jar" mx.com.txm.hlrsdata.scheduler.HLRS_Scheduler

/opt/HLRSDATA_2010_OCT/HLRS_Scheduler_Reports_sp.sh

/opt/HLRSDATA_2010_OCT/HLRS_Scheduler_Reports_Redundant_sp.sh
/opt/HLRSDATA_2010_OCT/HLRS_Delete_Data_sp.sh
/opt/HLRSDATA_2010_OCT/HLRS_Delete_Data_Redundant_sp.sh
/opt/HLRSDATA_2010_OCT/HLRS_Delete_Files.sh

The script is not running, I checked in /var/log/cron and theres not even a trace that it at least TRIED to run something.

Log:

Oct 18 08:47:19 isvahlrtk01 crontab[46449]: (root) END EDIT (root)
Oct 18 08:47:22 isvahlrtk01 crontab[46455]: (root) BEGIN EDIT (root)
Oct 18 08:47:35 isvahlrtk01 crontab[46455]: (root) REPLACE (root)
Oct 18 08:47:35 isvahlrtk01 crontab[46455]: (root) END EDIT (root)
Oct 18 08:57:18 isvahlrtk01 crontab[46540]: (root) LIST (root)
Oct 18 09:00:18 isvahlrtk01 crontab[46548]: (root) LIST (root)
Oct 18 09:04:24 isvahlrtk01 crontab[46563]: (root) BEGIN EDIT (root)
Oct 18 09:04:37 isvahlrtk01 crontab[46563]: (root) REPLACE (root)
Oct 18 09:04:37 isvahlrtk01 crontab[46563]: (root) END EDIT (root)
Oct 18 09:07:46 isvahlrtk01 crontab[46578]: (root) LIST (root)

Theres a newline at the end of my crontab (edited by crontab -e) and theres no /etc/crontab.allow (and crontab.deny is empty).

What could be preventing this to be executed?

Thanks in advance

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Check that the cron daemon is running

service crond status
crond (pid  23922) is running...

or

service crond status
crond is stopped

service crond start
Starting crond:                                            [  OK  ]
share|improve this answer
    
/doublefacepalm This was it. Thank you. –  Rhyuk Oct 18 '12 at 14:28

Make sure your script is executable. Also run your script manually first.

chmod +x scriptname.sh

It is important to not put an extension .sh to your bash script. It causes compatibility problems.

share|improve this answer
    
I can run the script manually perfectly with the same account/command mentioned above. –  Rhyuk Oct 18 '12 at 14:06
    
Source for "compatibility problems" with not using file extensions? –  Aaron Copley Oct 18 '12 at 14:11
    
@Aaron Copley sure: talisman.org/~erlkonig/documents/… –  val0x00ff Oct 18 '12 at 20:03
    
That wasn't very helpful to your case. It causes no compatibility problem at all. It seems that in rare situations where a script is rewritten, it increases the likelihood of user error. Honestly, it fails to execute once and you say, "Oh yea, I changed the script to use Perl, but not the filename." You change the filename to .pl and move on. –  Aaron Copley Oct 18 '12 at 20:51
    
I choose to disagree providing these facts. If you are writing for bash in this particular case you don't need to specify an extension. It will just confuse you and assumes you are using #!/bin/sh shebang tag, which subsequently will take away the flexability #!/bin/bash provides. –  val0x00ff Oct 18 '12 at 21:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.