- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Is today a holiday?
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
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
тАО05-24-2002 01:28 PM
тАО05-24-2002 01:28 PM
Points for all good suggestions.
TIA, Greg
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-24-2002 01:35 PM
тАО05-24-2002 01:35 PM
Re: Is today a holiday?
GL,
C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-24-2002 01:36 PM
тАО05-24-2002 01:36 PM
SolutionThere is a file that is seldom used anymore called /etc/acct/holidays. The format is rather simple but I bet yours is out of date and hasn't been touched in years. Edit it to make the year, holidays, and day offset correct for the current year.
You don't have toi do this but I suggest that you actually call your file /etc/acct/holidays_2001 and then symbolically link /etc/acct/holidays_2001 to /etc/acct/holidays. The year extension is my convention for caljd.pl but it will work in the current year without it.
Now here's your answer:
#!/usr/bin/sh
if [ $(caljd.pl -h) -ne $(caljd.pl) ]
then
echo "Today is a holiday.!!!"
else
echo "Bummer, I have to work today."
fi
caljd.pl -u will give full usage.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-24-2002 01:43 PM
тАО05-24-2002 01:43 PM
Re: Is today a holiday?
If you like, you can instead use the shell/awk equivalent, 'caljd.sh'. The options and usage are exactly the same; where you see caljd.pl in the above example substitute caljd.sh.
You could also play around with the date '+%j' format and then parse the holidays file but which do you think is easier.
By the way, a good way to determine the offsets for the holidays file is to do this:
caljd.sh 1 1 2002 - Julian Day of Jan 1
caljd.sh 7 4 2003 - Julian Day of July 4
Subtract the July 4th JD from Jan 1st JD and add 1 to the result and that is your offset for the /etc/acct/holidays file.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-24-2002 02:06 PM
тАО05-24-2002 02:06 PM
Re: Is today a holiday?
I found the /etc/acct/holidays file. I think this is just a typo on your part but did you mean 7 4 2002 instead of 7 4 2003? And did you mean soft link /etc/acct/holidays_2002 to /etc/acct/holidays instead of _2001?
Otherwise, your solution looks great!
Thanks for your help, Greg.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-24-2002 02:18 PM
тАО05-24-2002 02:18 PM
Re: Is today a holiday?
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-24-2002 05:53 PM
тАО05-24-2002 05:53 PM
Re: Is today a holiday?
Although he tripped on the rug on the way in....
But another job well hammered.
Sigh...I just wish I could script half as well as that.....and Perl to boot....
See - there's a reason some wear salad & most don't.
Rgds,
Jeff