Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
We have about 50 scripts that we run everyday.
How can we schedule this script to run automatically on the 5th of every month?
I can provide info if needed.
Thanks in advance

The unix cron utility is typically used to execute schedule jobs. Consider the contents of myfile:
0 0 5 * * /path/to/myscript
The myscript script now executes at midnight on the 5th.
Make sure that myscript contins the shell you want to execute since cron uses /bin/sh by default. Also, make sure myscript has PATH set.
This command sets cron for whatever user you are logged in as:
crontab < myfile
overwrites any previous cron.
Off topic: If you have scripts that share resources, you might check out:

Thank you so much for your response.
Can I follow up, please?
You said:
>>Make sure that myscript contins the shell >>you want to execute since cron >>uses /bin/sh by default. Also, make sure >>myscript has PATH set.How do I get shell and how do I ensure it?
Please be patient. I am a web developer and this just got dropped on my laps because the current owner of the project left.
thanks again

OK, some lazy shell programmers don't place in the script which shell they are using; they rely on how their environment is set which might be different from the cron utility.
On the first line of the shell script in the first column, you should see this line if it's a bourne script:
#!/bin/sh
If it is a korn shell script:
#!/bin/ksh
Take a look here for a comprehensive list of available shells:
http://www.allcommands.com/samples/...
The second thing I mentioned was PATH.
If your scripts are running correctly at the command line, check your PATH variable:
echo $PATH
Make sure the PATH is set within the scripts that will be run from cron:
PATH=...
export PATH

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |