HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to determine if the current day is a holiday?
Operating System - HP-UX
1833758
Members
2021
Online
110063
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
12-14-2004 08:54 AM
12-14-2004 08:54 AM
Hello Experts,
Is there a command to tell if the current day is a holiday? I know how to tell if today is during the weekend. Is there a file that maintains this information?
Thanks,
Greg
Is there a command to tell if the current day is a holiday? I know how to tell if today is during the weekend. Is there a file that maintains this information?
Thanks,
Greg
I know how to do it in pascal.
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2004 09:03 AM
12-14-2004 09:03 AM
Solution
There is a file, /etc/acct/holidays, that I bet you haven't touched in years. Bring it up to date. It's a bit tricky to parse so the easiest method would be some sort of date tool. Let's see, what might I use?
if [[ $(caljd.sh) -ne $(caljd.sh -h) ]]
then
echo "It's a holiday"
else
echo "It't ain't no holiday"
fi
Search the Forums for caljd.sh (or caljd.pl). That should fix you.
if [[ $(caljd.sh) -ne $(caljd.sh -h) ]]
then
echo "It's a holiday"
else
echo "It't ain't no holiday"
fi
Search the Forums for caljd.sh (or caljd.pl). That should fix you.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2004 09:10 AM
12-14-2004 09:10 AM
Re: How to determine if the current day is a holiday?
I suppose that I should add that there is also a useful tool to calculate the day offsets that are in the /etc/acct/holidays file. Let's see, what tool would that be?
To do Xmas 2004, for example:
OFFSET=$(( $(caljd.sh 12 25 2004) - $(caljd.sh 12 31 2003)) )
echo "Offset = ${OFFSET}"
This suggests a small script but I'll leave that as an exercise for you.
Invoke as caljd.sh -u and it will display full usage and examples and also mentions the holidays file. Caljd.sh actually looks for holidays_yyyy before holidays so that if New Year's Eve and New Year's Day (different years) were holidays you could skip both in the same calculation.
To do Xmas 2004, for example:
OFFSET=$(( $(caljd.sh 12 25 2004) - $(caljd.sh 12 31 2003)) )
echo "Offset = ${OFFSET}"
This suggests a small script but I'll leave that as an exercise for you.
Invoke as caljd.sh -u and it will display full usage and examples and also mentions the holidays file. Caljd.sh actually looks for holidays_yyyy before holidays so that if New Year's Eve and New Year's Day (different years) were holidays you could skip both in the same calculation.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2004 09:34 AM
12-14-2004 09:34 AM
Re: How to determine if the current day is a holiday?
Hi Clay,
Thanks. That worked great! I put today in the holiday file as a test and it recogized it.
When I searched for caljd.sh, I got dozens of hits.
Regards,
Greg
Thanks. That worked great! I put today in the holiday file as a test and it recogized it.
When I searched for caljd.sh, I got dozens of hits.
Regards,
Greg
I know how to do it in pascal.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP