====== Re-Post: Cron ====== //Note: This is taken from my previous blog - Published on: Jul 11, 2011 @ 10:35// Sounds very computer-ish isn't it? Well, it is... it's actually a scheduling table, something that computer system admins are very familiar with. It's nothing fancy, I could have written this in my wiki, which is what I usually would have done. But, since it's been quite a while since I last write something in this blog, I just feel like putting the info here. I know I'm going to regret this and spend more time transferring this to my wiki later... but I'll do it anyways :-p A task/job is made of 1 line with 6 items - 5 items/numbers represent time, and the last one is the job/task to be executed. Check it out... * * * * * job/task_to_be_executed ┬ ┬ ┬ ┬ ┬ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─── weekday (0 - 7) 0/7 => Sunday │ │ │ └──────── month (1 - 12) │ │ └───────────── day (1 - 31) │ └────────────────── hour (0 - 23) └─────────────────────── minute (0 - 59) I got the above 'figure' from wikipedia (with minor personal adjustments). To view your current cron jobs, type crontab -l So, how do we 'install' a new job? Type crontab -e which will open your default terminal editor (e.g. vi) and enter a task in the given format, then save. Voila! **Update20220307** So, after more than 10 years, I finally manged to transfer this to my wiki's mini-blog. Yay! 8-) Here are some additional info.. Some examples: * To run binary ''tool'' every hour: 0 * * * * /path/to/tool ... Special cases: * To run binary ''tool'' every 5 minutes: */5 * * * * /path/to/tool ... * To run binary ''tool'' on reboot/startup: @reboot /path/to/tool ... {{tag>computing linux}}