- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scheduling a backup to run every 3 weeks
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
05-16-2007 06:37 AM
05-16-2007 06:37 AM
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2007 06:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2007 07:25 AM
05-16-2007 07:25 AM
Re: Scheduling a backup to run every 3 weeks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2007 07:26 AM
05-16-2007 07:26 AM
Re: Scheduling a backup to run every 3 weeks
http://www.hpux.ws/merijn/caldj.sh
http://www.hpux.ws/merijn/caldj.pl
Run the job as a weekly cron job and use one of those two honeys to determine if its the third week of the month and any real work needs to be done.
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
05-16-2007 07:52 AM
05-16-2007 07:52 AM
Re: Scheduling a backup to run every 3 weeks
Here's a solution that works every time across year boundaries:
Download the attached caljd.sh; make it execuitable; and install it in a convenient directory, e.g. /usr/local/bin.
Now run your cron'ed script every Saturday and the script itself decides if this is the 3rd Saturday:
-------------------------------------------
#!/usr/bin/sh
export PATH=${PATH}:/usr/bin:/usr/local/bin
typeset -i STAT=0
typeset -i STARTWK=1 # set to 0, 1, or 2
# --------------- depending upon when you
# --------------- want to start
if [[ $(( (($(caljd.sh) + 1) / 7) % 3 )) -eq ${STARTWK} ]]
then
echo "Do your thing and set the exit status"
STAT=${?}
fi
exit ${STAT}
---------------------------------------------
By adding 1 to the current Julian Day, the weeks start on Sunday then we simply integer divide by 7 to get the week number and then do a MOD 3. Julian Days simply count sequentially from 4713BCE and don't care about year boundaries at all. Invoke as caljd.sh -u for full usage and examples.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2007 08:05 AM
05-16-2007 08:05 AM
Re: Scheduling a backup to run every 3 weeks
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2007 08:07 AM
05-16-2007 08:07 AM