- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: How to schedule work in every two hours? two d...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2004 03:08 PM
09-19-2004 03:08 PM
How to schedule work in every two hours? two days? etc
Can cron do on this way? how?
thanks for your tips
Fredeirck van targero
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2004 03:31 PM
09-19-2004 03:31 PM
Re: How to schedule work in every two hours? two days? etc
30 4,16 * * * /usr/contrib/bin/mirror.sites 2>&1 | mail -s "merijn mirror" your@mail.com
that does a job at 4 am and 4 pm 20 minutes after the hour
change it to:
30 0,2,4,6,9,10,12,14,16,18,20,22 * * * /usr/contrib/bin/mirror.sites 2>&1 | mail -s "merijn mirror" your@mail.com
Now the job runs every two hours in this case at 30 minutes after the hour
The next feild is day of the mont, that asterisk after the 22
pick your days again
30 4 2,4,6,8,10 * * /usr/contrib/bin/mirror.sites 2>&1 | mail -s "merijn mirror" your@mai.com
This runs a job every two days the first 10 days of the month at 4:30 a.m.
All this is fron the wonderful man crontab
My examples email the output as well.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2004 05:42 PM
09-19-2004 05:42 PM
Re: How to schedule work in every two hours? two days? etc
minute 0-59
hour 0-23
day of month 1-31
month 1-12 (or names, see below)
day of week 0-7 (0 or 7 is Sun, or use names)
we can schedule the task execution on cron jobs.
To execute every two hours of one task the,
0 0,2,4,6,8,10,12,14,16,18,20,22 * * * command > (redirection)
Example:
0 0,2,4,6,8,10,12,14,16,18,20,22 * * * uname -a > 1>/tmp/uname.log 2>&1
To excute it on two days once then,
0 10 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29 * * uname -a > 1>/tmp/uname.log 2>&1
It will execute the task at 10.00 on 1,3,.. days of everymonth
Depends upon the setting we can execute tasks with cron.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2004 05:43 PM
09-19-2004 05:43 PM
Re: How to schedule work in every two hours? two days? etc
*/
i.e. to perform something every 2 hours, isntead of having a comma-separated-list like SEP suggests (there's nothing wrong with that btw):
15 */2 * * * /path/to/command
Which translates to the comma-separated-list of 0,2,4,6,8,10,12,14,16,18,20,22 - every 2 hours.
It works with all fields in the time specifier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2004 01:50 AM
09-21-2004 01:50 AM
Re: How to schedule work in every two hours? two days? etc
minute 0-59
hour 0-23
day of month 1-31
month 1-12 (or names)
day of week 0-7 (0 or 7 is Sun, or use names)
If you want to schedule a work for every 2 hour s you can do that by
* */2 * * * /PATH/TO/COMMAND
To schedule for every 2 days:
* * */2 * * /PATH/TO/COMMAND
See "#man 5 crontab" for more details.
Regards,
Senthil Murugan