- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to make a cron task holiday aware?
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-22-2003 09:12 AM
05-22-2003 09:12 AM
Nobody will be here Monday (Memorial Day) to change backup tapes. Is there a way to have cron not run the tasks on holidays?
TIA, David
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2003 09:16 AM
05-22-2003 09:16 AM
Re: How to make a cron task holiday aware?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2003 09:16 AM
05-22-2003 09:16 AM
Re: How to make a cron task holiday aware?
ex.
touch /tmp/holiday
if [ -f /tmp/holiday ]; then
exit #...take the day off!
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2003 09:20 AM
05-22-2003 09:20 AM
SolutionThe direct answer to your question is "NO"; cron don't know nothing about no holidays. The tasks themselves will have to determine if today is a holiday and, if so, exit.
There is a seldom used file, /etc/acct/holidays that you need to update then caljd.sh can handle the task.
In your croned script:
if [[ $(caljd.sh) -ne $(caljd.sh -h) ]]
then
echo "Today is a holiday"
exit 0
fi
# otherwise continue with task
You will probably need to use caljd.sh to calculate the day offsets for the holidays file. I suggest that you actually create a holidays_2003 file and symbolically link it to the holidays file. Caljd.sh will preferentially use the _YYYY file and you just might need to skip over New Year's eve and New Year's Day. The standard holidays file won't handle that.
You should be able to search and find a copy of caljd.sh (or caljd.pl if you prefer). Make sure that you get version 2.1; it's the latest.
Invoke as caljd.sh -u for full usage and an explanation of the -h switch.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2003 09:28 AM
05-22-2003 09:28 AM
Re: How to make a cron task holiday aware?
Then I have to log in durig the holiday and restart the daemon.
That's hardly fair is it?
What I have done is make the scripts themselves holiday aware.
They have date checking against a holiday list and most of them self terminate on that basis.
cron is stupid, it runs the way you program it. It is the servant of the systems administrator, only as smart as the admin makes it.
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-22-2003 10:12 AM
05-22-2003 10:12 AM
Re: How to make a cron task holiday aware?
Why not just leave the tapes in and let the next backup over write them?
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2003 12:24 PM
05-22-2003 12:24 PM
Re: How to make a cron task holiday aware?
That was my first thought but it was shot down as not being ISO 9000 compliant. It seems that if a backup tape is marked 'Monday' it better damn well have only Monday's data on it.
Hi Clay,
You hinted that I could use caljd.sh to set the values in the holidays file. Could you please post an example.
Thanks, David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2003 12:33 PM
05-22-2003 12:33 PM
Re: How to make a cron task holiday aware?
Here is July 4th, 2003
OFFSET=$(($(caljd.sh 7 4 2003) - $(caljd.sh 1 1 2003) + 1))
echo "Offset: ${OFFSET}"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2003 08:15 PM
05-22-2003 08:15 PM
Re: How to make a cron task holiday aware?
1> If you know the list of holidays in the year, simply create a file in your favourite location, having the dates.
2> In the beginning of your script, just put a simple "if", asking it to check the presence of today's date in the "holiday" file. If today is a holiday, let the script exit there it self.
3> This would be one time job per year, and you can enjoy your holidays without worrying about the scheduled job.
4> This would safe-guard the interest of other scheduled jobs as well.
Hope this helps...
Regards..
Suhas