You control your cron job by using the crontab command or by editing /var/spool/cron/crontabs/<username>. If you wanted to schedule a job as root you would run
This will start whats appears to be vi (this will scare you if you haven't used it before) to let you edit the file. When you leave the file it notifies cron about the change so the updates take place.
If you wanted to remove all files in a directory called /myDir once a week, say at 09:00 on a Monday then you would have something like this in your crontab
Code:
0 9 * * 1 /bin/rm -rf /myDir/*
The format of the crontab is
mins hrs day-of-month month weekday cmd and the range of these values are
Code:
mins :: The minutes after the hour. :: 0-59
hrs :: The hours of the day. :: 0-23 (0 = midnight)
day-of-month :: The day within a month. :: 1-31
month :: The month of the year. :: 1-12
weekday :: The day of the week. :: 0-6 (0=Sunday)
If the command produces any output then it will be emailed to the user. To avoid this you either need to ensure that your command doesn't produce anything or redirect any possible output using something like
Code:
myCommand > /dev/null 2>&1
Does that make sense?
HTH
Jamie...