- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script for last working day of the month
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
07-22-2005 07:43 AM
07-22-2005 07:43 AM
Could you guide me into creating a script that will verify if the current day is the last working day of the month - and if yes, then do some other command.
I use a platform with HP-UX 11i.
Thank you in advance,
Alex.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2005 10:50 AM
07-22-2005 10:50 AM
Re: Script for last working day of the month
http://mirrors.develooper.com/hpux/caljd-2.23.sh
and give it a test run. You may need to do some additional testing on the output like how many more days in this month and if this is the last friday or incorporate a company holiday calendar into it etc. Everyone's need is different but this script is always a very good starting point.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2005 10:51 AM
07-22-2005 10:51 AM
SolutionBy last working day of the month, I assume you mean if tomorrow skipping past weekends is a new month then today is the last working day of the month.
#!/usr/bin/sh
if [[ $(caljd.sh -M -n 1 -x 6 -x 0) -ne $(caljd.sh -M) ]]
then
echo "Last working day of the month; do your thing"
else
exit 0
fi
Now, if you will bring your /etc/acct/holidays file up to date, it's even smart enough to know about them and your command becomes:
#!/usr/bin/sh
if [[ $(caljd.sh -M -n 1 -x 6 -x 0 -h) -ne $(caljd.sh -M) ]]
then
echo "Last working day of the month; do your thing"
else
exit 0
fi
Invoke as caljd.sh -u for full usage and many examples.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2005 07:36 PM
07-22-2005 07:36 PM
Re: Script for last working day of the month
As I'm kind of new to this "scripting stage" it will take me a while to understand your script Clay :)
Anyway, it's a good thing I have whom to learn from.
Thanks again,
Alex.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2005 06:51 PM
07-24-2005 06:51 PM