Marvel John
Marvel John

Reputation: 193

Shell script (.sh file) not working in crontab but it's working alone

30 11 * * * /home/ubuntu/Projects/scripts/Sample.sh

and the syslog file includes:

Jun 28 11:30:01 ip-10-98-125-10 CRON[4225]: (tomcat7) CMD (/home/ubuntu/Projects/scripts/Sample.sh)

Please help me; I have been stuck on it!

Upvotes: 0

Views: 2185

Answers (1)

Will
Will

Reputation: 842

Here we need to specify the shell command to run the script.

30 11 * * * sh /home/ubuntu/Projects/scripts/Sample.sh

It is obvious that you can not even run /home/ubuntu/Projects/scripts/Sample.sh in your interactive shell line. Because we need to run either ./home/ubuntu/Projects/scripts/Sample.sh (only if Smaple.sh is executable) or sh /home/ubuntu/Projects/scripts/Sample.sh

So don't forget sh or bash.

Upvotes: 1

Related Questions