- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Crontab on first Tuesday of every 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
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
тАО10-04-2004 02:09 AM
тАО10-04-2004 02:09 AM
I need to run a script on the first Tuesday of every month. Is there an easy way to do this via crontab. I have tried 00 12 1-7 * 2 ksh script but as the entries are cumulative it runs on all dates from 1 to 7. I have done it previously on Unixware by writing a script to run the cal command and retrieve the date of the first Tuesday from there. Is there a simple way with cron.
Thanks,
Tim
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2004 02:13 AM
тАО10-04-2004 02:13 AM
Solutionhttp://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=708384
Rgds..Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2004 02:17 AM
тАО10-04-2004 02:17 AM
Re: Crontab on first Tuesday of every month
Use one of these scripts to decide if its the first Tuesday of the month and run or exit.
http://www.hpux.ws/merijn/caljd-2.23.sh
http://www.hpux.ws/merijn/caljd-2.2.pl
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2004 02:31 AM
тАО10-04-2004 02:31 AM
Re: Crontab on first Tuesday of every month
The solution is quite simple:
Use the mentioned caljd.sh; Version 2.23 is the latest and install it on your box; e.g. /usr/local/bin.
#!/usr/bin/sh
export PATH=${PATH}:/usr/local/bin
if [[ $(caljd.sh -N) -eq 1 ]]
then
echo "1st Tuesday; 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
тАО10-04-2004 02:34 AM
тАО10-04-2004 02:34 AM
Re: Crontab on first Tuesday of every month
I think I will run the script on every Tuesday & use the following to get the date of the first Tues. Many Thanks. Points awarded
cal | awk '{print $3}' | grep -v "^$" | grep -v "Tu" | head -1
Rgds,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2004 02:42 AM
тАО10-04-2004 02:42 AM
Re: Crontab on first Tuesday of every month
typeset -i x=`date "+%d"`
if [[ $x -gt 7 ]] ; then exit
HTH
-- Rod Hills