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

user9517
  • 115,471
  • 20
  • 215
  • 297
Rhyuk
  • 404
  • 2
  • 8
  • 15

2 Answers2

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  ]
user9517
  • 115,471
  • 20
  • 215
  • 297
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.

Valentin Bajrami
  • 4,045
  • 1
  • 18
  • 26
  • 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: http://www.talisman.org/~erlkonig/documents/commandname-extensions-considered-harmful – Valentin Bajrami 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. – Valentin Bajrami Oct 18 '12 at 21:56