![]() How to Execute a Linux Command After Every Reboot using the cron keyword, this will execute the specified command once after the machine got booted every time. home/ramesh/arch-linux/bin/cleanup-logs "day started" 11. Schedule a Background Job Every Day using the cron keyword, this will do a daily log file cleanup using cleanup-logs shell scriptat 00:00 on every day. This will execute the shell script tape-backup at 00:00 on 1st of every month. But executes the command monthly once using cron keyword. Schedule a Cron Job Beginning of Every Month using is as similar as the as above. home/ramesh/red-hat/bin/annual-maintenance 9. This will execute the system annual maintenance using annual-maintenance shell script at 00:00 on Jan 1st for every year. Schedule a Job For First Minute of Every Year using you want a job to be executed on the first minute of every year, then you can use the cron keyword as shown below. Table: Cron special keywords and its meaning 0 1 1 0 * * * * * at startup.Ĩ. There are special cases in which instead of the above 5 fields you can use followed by a keyword - such as reboot, midnight, yearly, hourly. Instead of specifying values in the 5 fields, we can specify it using a single keyword as mentioned below. The above examples shows how to do those things. But you may have a requirement of executing the command only during office hours or vice versa. It executes the specified command check-disk-space every 10 minutes through out the year. */10 * * * * /home/ramesh/check-disk-space Use the following, if you want to check the disk space every 10 minutes. Schedule a Background Cron Job For Every 10 Minutes. Thus the above convention can be used for all the other 4 fields.ħ.When you specify 0-10/2 in minute field mean every 2 minutes in the first 10 minute.When you specify */5 in minute field means every 5 minutes.More than using this * directly, you will find it very useful in the following cases. The * means all the possible unit - i.e every minute of every hour through out the year. But understanding this example will will help you understand the other examples mentioned below in this article. Ideally you may not have a requirement to schedule a job every minute. Schedule a Job for Every Minute Using Cron. crontab -u sathiya /home/sathiya/fedora/bin/monthly-backupĠ0 09-18 * * * /home/sathiya/ubuntu/bin/check-db-status To view crontab entries of other Linux users, login to root and use -u -e as shown below. No crontab for root Crontab HowTo: View Other Linux User’s Crontabs entries Login as root user (su – root) and do crontab -l as shown below. To view your crontab entries type crontab -l from your unix account as shown crontab /home/ramesh/annual-maintenance How to View Crontab Entries? View Current Logged-In User’s Crontab entries 1-5 -Mon, Tue, Wed, Thu and Fri (Every Weekday)Ĥ. ![]() This example checks the status of the database every weekday (i.e excluding Sat and Sun) during the working hours 9 a.m – 6 p.m.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |