- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Is today the last working day?
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-31-2002 01:35 PM
тАО05-31-2002 01:35 PM
I did a search and found some ideas about finding out if today is the last day of the month. I have a little tougher problem. I need to know if this is payday which our company defines as the last WORKING day of the month. For example, if March 29th is a Friday, the 30th is Saturday, and the 31st is Sunday then Friday the 29th is the last working day of the month even if it is not the last day of the month.
Points for any clues or solutions.
Please help, Ryan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2002 01:42 PM
тАО05-31-2002 01:42 PM
Solutionif [ $(caljd.sh -M) != $(caljd.sh -x 6 -x 0 -n 1 -M) ]
then
echo "This is the last working day of the month; I get paid!"
else
echo "It ain't payday"
fi
All we are doing is comparing today's month with
tomorrow's (-n 1) if we skip Saturdays (-x 6) and Sundays (-x 0).
If you do a search for caljd.sh (or caljd.pl), you should be able to find a copy. Version 2.05 is the latest. You can substitute caljd.pl for caljd.sh if you like; the arguments are identical.
That should fix you, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2002 01:56 PM
тАО05-31-2002 01:56 PM
Re: Is today the last working day?
Eventhough you didn't mention it, today might also be payday if tomorrow is a company holiday. I've got you covered there as well, if you've kept your /etc/acct/holidays file up to date.
One minor change will take into account holidays: Add the -h (skip holidays flag).
if [ $(caljd.sh -M) != $(caljd.sh -x 6 -x 0 -h -n 1 -M) ]
then
echo "This is the last working day of the month; I get paid!"
else
echo "It ain't payday"
fi
You can invoke caljd.sh -u for full usage.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2002 02:01 PM
тАО05-31-2002 02:01 PM
Re: Is today the last working day?
Clay's "Date Hammer" *will* fix virtually all scripts that are date related. (Mind you I've not found a situation where it hasn't!) We have implemented a number of scripts that include this tool and it is very handy.
(Had to give it a plug Clay!)
Cheers
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2002 02:04 PM
тАО05-31-2002 02:04 PM
Re: Is today the last working day?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2002 02:06 PM
тАО05-31-2002 02:06 PM
Re: Is today the last working day?
lastday=`cal | awk '$2!=""{last=$NF}END{print last}'`
--Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2002 02:08 PM
тАО05-31-2002 02:08 PM
Re: Is today the last working day?
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2002 02:26 PM
тАО05-31-2002 02:26 PM
Re: Is today the last working day?
Thanks to everybody, Ryan