1

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

2 Answers 2

5

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 ] 
0
1

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.

5
  • I can run the script manually perfectly with the same account/command mentioned above. Commented Oct 18, 2012 at 14:06
  • Source for "compatibility problems" with not using file extensions? Commented Oct 18, 2012 at 14:11
  • @Aaron Copley sure: talisman.org/~erlkonig/documents/… Commented Oct 18, 2012 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. Commented Oct 18, 2012 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. Commented Oct 18, 2012 at 21:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.