creating cron jobs
How does one go about creating cron jobs? For example, How can I empty the contents of a directory to a floppy, cd, or zipdrive every week? Are there any how-to's, websites, or better yet, any scripts people have already written?
Thanks, Jon |
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
Code:
crontab -e 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/* Code:
mins :: The minutes after the hour. :: 0-59 Code:
myCommand > /dev/null 2>&1 HTH Jamie... |
if your under redhat 6.2+ it's a damn sight easier to just add an entry to the /etc/crontab file. Maybe create a new directory in line with the file, and just put a script file in that directory maybe... MUCH easier than actually understanding cron!
Chris xxxx |
Put the executable in the /etc/cron.weekly directory.
I run Mandrake 7.2 and it has several directory's under the /etc directory. cron.hourly, cron.daily, cron.weekly, cron.monthly. Any executable in those directorys get executed at the appropriate interval. |
i've popped a file in the cron.daily and wondering how to make it run. the file simply clears out all "*.CKP" files on the system but it doesn't seem to be running. any special way to enable it or they should just run when in the cron.daily directory?
thanks medamnit |
Is it executable? Have you checked the permissions? What are they?
Have you tested the script manually? Did it work? What are .ckp files? and why do you need to clear them daily? |
All times are GMT -5. The time now is 10:23 PM. |