Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Crontab not executing



Morning Dave.

You generally want to include the full path in commands you use in your cron.
sh would normally live in /bin, so you'd need something like:

0 12 * * * /bin/sh /home/dave/myShellScript.sh

The above should successfully run the script, although it's a bit long.

You may also want to check that you're using the full path of commands you use inside the script. Otherwise the script may run, but not do what you want. (All this is necessary because the cron runs with a different set of environment variables to your regular shell.)

The more conventional way to do it would be to skip the initial sh altogether. Normally, the first line of your shell script would be
#!/bin/sh
and the script would have its execute permissions turned on (chmod +x myShellScript.sh to make it executable) so  you can call it on its own like this:

0 12 * * * /home/dave/myShellScript.sh

Hope that helps,

Edmund

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links