- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Make cron skip holidays?
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
08-26-2002 12:04 PM
08-26-2002 12:04 PM
Thanks in advance for any help,
Bob
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2002 12:07 PM
08-26-2002 12:07 PM
SolutionThis is much simpler:
if [[ $(caljd.sh) -ne $(caljd.sh -h) ]]
then
echo "Today is a holiday."
fi
Pretty simple.
Here's the required script. Just make sure that caljd.sh is in your PATH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2002 12:09 PM
08-26-2002 12:09 PM
Re: Make cron skip holidays?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2002 12:09 PM
08-26-2002 12:09 PM
Re: Make cron skip holidays?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2002 12:21 PM
08-26-2002 12:21 PM
Re: Make cron skip holidays?
I.E.
TODAY=`date +%j`
for DAY in `cat /etc/acct/holidays|grep -v ^\*|grep -v ^2002`; do
if [ "${DAY}" = "${TODAY}" ] ; then
echo "Today is a holiday"
exit 0
else
echo "">>/dev/null
#fall through, run code
fi
done
Of course this requires that you have a valid file /etc/acct/holidays updated anually on each system where you will be running these kinds of scripts.
Regards,
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2002 12:23 PM
08-26-2002 12:23 PM
Re: Make cron skip holidays?
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2002 12:33 PM
08-26-2002 12:33 PM
Re: Make cron skip holidays?
Because both New Year's Eve and the next New Year's Day are often holidays, I suggest that you take advantage of a little 'improvement' that I made to the holidays file. Setup /etc/acct/holidays_2002,/etc/acct/holidays_2003, ... files. You then symbolically link holidays_YYYY to /etc/acct/holidays so that all the accounting utilities work as usual. Caljd.sh looks first for the _YYYY file so it will even cover you when you cross year boundaries. If caljd.sh does find the _YYYY holidays file; it reverts to the 'vanilla' filename so in all cases it works as expected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2002 12:40 PM
08-26-2002 12:40 PM
Re: Make cron skip holidays?
You guys are great.
Bob