- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Setup a cron job to be run on 1st monday of every ...
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
Discussions
Discussions
Discussions
Forums
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
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
тАО11-05-2007 11:14 AM
тАО11-05-2007 11:14 AM
Setup a cron job to be run on 1st monday of every month
How to setup acron job , which runs on 1st monday of every month at 10 AM.
I have thought something like this
00 10 1-7 * 1
but as per crontab man page , if you specify
day and dow both , result will be cumulative , i.e it will do both .
so i am afraid if it runs on 1-7 and every monday of all months.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-05-2007 11:49 AM
тАО11-05-2007 11:49 AM
Re: Setup a cron job to be run on 1st monday of every month
Let your script determine if the date falls within the first week. Simply create your crontask to run at 1000 on _every_ Monday and within your script do:
...
[ $(date +%d) -gt 7 ] && exit
...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-05-2007 12:52 PM
тАО11-05-2007 12:52 PM
Re: Setup a cron job to be run on 1st monday of every month
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-05-2007 12:59 PM
тАО11-05-2007 12:59 PM
Re: Setup a cron job to be run on 1st monday of every month
yes this is the cron limitation, so as JRF specified, the script should be used to further determine if the day is < 7 ...
Regards,
RD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-05-2007 04:11 PM
тАО11-05-2007 04:11 PM
Re: Setup a cron job to be run on 1st monday of every month
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1156357
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1153076
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1096366
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1131448
As Clay said, it is better to check the day of week in your script. You might want to have a comment in your cron file that notes that.
The thread with 1096366 shows you how to check for the day of week no matter what locale.
>RD: this is the cron limitation,
(More like the cron standard.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-07-2007 12:50 PM
тАО11-07-2007 12:50 PM
Re: Setup a cron job to be run on 1st monday of every month
Your cron line could look something like this:
0 0 1 * * at -f script 10:00 Monday 2> dev/null
This will execute the "at" job on the next occurrence of 10am on Monday ... the "script" can be any file of commands or a shell script or even a perl script.
I use this mechanism, for example, to schedule Ignite backups to run over the first weekend of the month.