CRONTAB does not execute the .sh file
source link: https://www.codesd.com/item/crontab-does-not-execute-the-sh-file.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
CRONTAB does not execute the .sh file
I am accessing my linus box from putty.I have a Java Progaram packed in a Jar File. I have made a scheduler.sh file that sets Java Path and execute the Java Program.SO far everything is good when i run the Scheduler.sh, the Java programs runs.
The content of the Scheduler.sh is
#!/bin/sh
> echo "The Script Starts now!!!!!!!!!!"
>
> export JAVA_HOME=/u01/app/oracle/java/java64/jrockit-jdk1.6.0_29
> export PATH=$JAVA_HOME/bin:$PATH cd
> /u01/CRM/softwaredepot/jarfiles/
>
> java -jar EPALS_Linux.jar
>
> echo "The Script ends now!!!!!!!!!!"
Now I want to execute this using CRONJOB.So I added this to CONJOB
[sankalp@elb1cn11 ~]$ crontab -e
53 13 * * * /u01/CRM/softwaredepot/Scheduler.sh>tester.log
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/tmp/crontab.XXXXU8TrO9" 2L, 64C
Nothing happend.But when i executed this line(mentioned in the crontab
/u01/CRM/softwaredepot/Scheduler.sh>tester.log it ran successfully.So it means the entry in the crotab is also correct.Then why is it not executing.Kindly help me
You don't specify what you run the script with. e.g bash
or sh
53 13 * * * bash /u01/CRM/softwaredepot/Scheduler.sh>tester.log
Since you have specified, the shebang in the start : #!/bin/sh
it should automatically run with sh, so it could be permissions. It does have not the right to execute.
run chmod +x shcripname.sh
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK