- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- cron scheduling
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
11-23-2004 04:02 AM
11-23-2004 04:02 AM
I want to schedule a job with cron, and have it run every first saturday of each month. To do so, I used this settings :
00 05 1-6 * 6 myjob
I expect this setting to run myjob each saturday, between the 1 and the 6 of the month, wich is equivalent to first saturday.
But it doesn't act so. It runs every saturday of the month AND every day between the 1 and 6 of the month. Is this normal behaviour ?
System is 11.00 64 bits with march 2003 quality pack patches.
>swlist -l patch | grep cron
# PHCO_21494 1.0 Cumulative cron/at/crontab patch
# PHCO_22767 1.0 cumulative crontab/at/cron patch
# PHCO_27141 1.0 cumulative crontab/at/cron patch
Regards,
Fred
"Reality is just a point of view." (P. K. D.)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2004 04:09 AM
11-23-2004 04:09 AM
Re: cron scheduling
this is quite normal.
cron behaviour is cumulative. It runs on the specified days,
Try this link for s similar sitation as yours,
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=535974
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2004 04:10 AM
11-23-2004 04:10 AM
Re: cron scheduling
The way to accomplish this is to run the job every Saturday.
Then use the magic http://www.hpux.ws/merjin/caljd.sh script by A. Clay to figure out if its really the first Saturday of the month and to continue execution.
Thats how I handle it.
The script is very well documented.'
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
11-23-2004 04:13 AM
11-23-2004 04:13 AM
Re: cron scheduling
Gives you the date of the first Saturday. Put this in a script. Now run your cron on every saturday. If the date is "date received by above command", then run the job, else not.
Also set cron as follows.
00 05 * * 6 myjob
Hope this helps.
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2004 04:13 AM
11-23-2004 04:13 AM
SolutionWhat you need to do is run your command every Saturday and let your script itself determine if this is the 1st Saturday. Let's see, this sounds like a date problem. I wonder which tool I'll use?
In your script that fires off each Sat. do something like this:
#!/usr/bin/sh
PATH=${PATH}:/usr/local/bin
export PATH
if [[ $(caljd.sh -N) -eq 1 ]]
then
echo "1st occurence in the Month; do your thing."
else
echo "It ain't; do nothing"
fi
Invoke as caljd.sh -u for full usage and what this does.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2004 04:33 AM
11-23-2004 04:33 AM
Re: cron scheduling
I should have guess caljd was to mentionned on such a thread :)
Not that it's not that I don't like your script, but I find it a little bit simplier to set in cron
00 05 1-6 * * myjob
and start my script with a test on "date +%u"
Thanks again for making clear this point about cron using OR and not AND...
Regards,
Fred
"Reality is just a point of view." (P. K. D.)