|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Auto Run Scripts
I have a script that will be running on Solaris 9 and I was wondering if it is at all possible to have this script run every couple of hours? Anyone know how to do this?
|
|
#2
|
|||
|
|||
|
Yes indeed!!! What you want to do is look at cron (man cron, man crontab). Major thing is to ensure the script is executable and that you are not making any assumptions about the PATH variable (jobs run by cron get a really basic set of environment variables).
crontab -e (to edit the cronfile for the current user) insert a line like: 30 0,2,4,6,8,10,12,14,16,18,20,22 * * * /path/to/script to have it run every two hours at 30 minutes past, every day of the year. Change the leading 30 to 00 to have it run on the hour, to 10 to have it run at 10 minutes past,etc. |
|
#3
|
|||
|
|||
|
question
i tried to run "crontab -e" to edit the crontab file and im getting the following:
sh: emacs: not found crontab: temporary file empty It will run on a Solaris 8 install correct?? |
|
#4
|
|||
|
|||
|
Quote:
crontab -e opens an editor so you can write the file. In this case it is looking for emacs which apparently isn't installed. You almost certainly have vi so set a couple of environment variables and try it again. Code:
export EDITOR=vi export VISUAL=vi |
|
#5
|
|||
|
|||
|
Thanks
That did the trick, thanks for your help. One last question. I know the syntax for the crontab file but does the file have to reside in a particular directory ? or can it just be in the home directory of the user?
|
|
#6
|
|||
|
|||
|
It can reside in any directory that can be accessed.
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Auto Run Scripts |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|