Rosemary McGillicuddy wrote:
On Friday 04 Mar 2005 21:09, Rosemary McGillicuddy wrote:A quick guide to the cron directories. If you put a script in the cron.<frequency> directory, and it is executable, then it will be run every <frequency>. So, if you put a script called backup in cron.daily, cron run
Further question. Have been looking at cron directories (I think anyway!). Have a long list of /etc/rc or etc/cron.daily /etc/cron.hourly and so on.
With regard to the above script - do I navigate to the appropriate line eg /etc/cron.daily then insert the script?
I know this sounds basic to experienced users, but it is like speaking a foreign language to me.
Thanks Rosemary
"chmod +x backup", then it will be run every night with the rest of the executable files in that directory. If you want to disable a script, you can run chmod -x <script> and it will not be run, until you enable it again. This is handy because you don't have to hunt for the script when you want to enable it again.
This is handy for system scripts. It is not for user scripts. Users normally can not install scripts in the cron directories. If user cron job are enabled, a user can run "crontab -e" to add their own jobs. You will want to read up on this if you are going to use it, because you are entering the script here. Instead, you are setting up when the script will be run, and what script to run. The format is a bit cryptic at first. But it will allow fins control of when a job will be run. Do you want it to run on Thursday mornings at 8:27? It can be set here. You could also set a job to run every 5 minutes on Monday night from 6 to 9 pm. Or you can set a job to only run on the 11 day of the month.
One thing you have to be careful of when writing scripts to be run as cron jobs - the envirment is not the same one as you get when you log in as a user. So a script that will run just fine from the command line may not run as a cron job. It helps to specify the path to programs, or to set PATH at the start of the script, so that you can be sure any programs you call in the script are found... (Well, enough rambling for one day!)
Mikkel
-- Remember: Sometimes the dragon wins!
____________________________________________________ Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Join the Club : http://www.mandrakeclub.com ____________________________________________________
