- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: cron on 3rd friday
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
09-19-2003 10:18 AM
09-19-2003 10:18 AM
Is there any way to schedule cron execution on
every 3rd friday each month ?
so far I'm using:
0 12 * * 5 /appl/email/suka
but it's for every friday and shell handles this internally checking for existince some control files.
Thanks all.
D
Solved! Go to Solution.
- Tags:
- crontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 10:23 AM
09-19-2003 10:23 AM
Re: cron on 3rd friday
The way you are doing it is probably the best way there is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 10:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 10:31 AM
09-19-2003 10:31 AM
Re: cron on 3rd friday
I'll call myself an idiot first - that would run the job every day from the 15th through the 21st and every friday.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 10:37 AM
09-19-2003 10:37 AM
Re: cron on 3rd friday
I was about to post the same answer but I bailed out after I tested it. It looks good but the 'monthday' and 'weekday' parameters are cumulative, so it runs every Friday. Bummer!
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 10:50 AM
09-19-2003 10:50 AM
Re: cron on 3rd friday
Run the program every friday.
Use A. Clay Stephenon's caljd.sh program to figure out whether its the third friday in the month and execute only if its the third friday.
outline
#program start
# What friday number is it ???
# If its not the third firday.
exit 0;
else
execute desired code.
SEP
To find caljd.sh, go to procura's web site.
http://www.cmve.net/~merijn/
Attaching my version which is not current.
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
09-19-2003 10:58 AM
09-19-2003 10:58 AM
Re: cron on 3rd friday
#!/usr/bin/sh
typeset -i10 DAY=$(date '+%d')
if [[ ${DAY} -ge 15 && ${DAY} -le 21 ]]
then
echo "Your commands go here."
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 10:58 AM
09-19-2003 10:58 AM
Re: cron on 3rd friday
"Like minds think great" or something like that.
;^)
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2003 02:48 AM
09-22-2003 02:48 AM
Re: cron on 3rd friday
use it any sitp that you want to do date manipulation work. such as what you are trying to perform.
or if you want to run a job on the 3rd business day of each month through cron. wierd, not uncommon.
1st step. find out what is the day count for each 3rd friday of the year and record that list.
2nd step, copy this conf tool in you script and source it to do date convertion for you.
DT=`date +%D`
echo "$DT\nq\n" | date2julian | awk '{print $9}' | read DATE
echo "$DT" | sed "s/\// /gp" | read M D Y # today's date
(( YESTERDAY = $DATE - 1 ))
echo "$YESTERDAY\nq\n" | date2julian | awk '{print $7}' | read ETAD
echo "$ETAD" | sed "s/\// /gp" | read MM DD YY # yesterdays date
once you have this info, you can do the date check.
say your list is 5, 15, 23, 32, etc...
then you want to do a check if this is the 3rd friday of the month.
if [ $DATE = 5 || $DATE = 15 || $DATE = 23 .... ]
then
echo this is 3rd friday
do your job
else
# not 3rd friday
exit 0
fi
have fun
Donny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2003 02:49 AM
09-22-2003 02:49 AM
Re: cron on 3rd friday
peace
Donny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2003 10:40 AM
09-22-2003 10:40 AM
Re: cron on 3rd friday
WEEKNO=$(caljd.sh -N)
if [[ ${WEEKNO} -eq 3 ]]
then
echo "3rd Friday; your commands go here"
fi
To determine if a given date is the 2nd occurrence of the weekday in a month, you could do this test:
WEEKNO=$(caljd.sh -N 9 12 2003)
if [[ ${WEEKNO} -eq 2 ]]
then
echo "2nd"
fi
Invoke as caljd.sh -u for full usage. This is caljd.sh Version 2.21.
- Tags:
- caljd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2003 10:41 AM
09-22-2003 10:41 AM
Re: cron on 3rd friday
Here is caljd.pl, Version 2.21p.
- Tags:
- caljd