<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: cron on 3rd friday in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075388#M141540</link>
    <description>Here is the Perl version. The arguments are exactly the same as caljd.sh simply substitute caljd.pl for caljd.sh, if you like.&lt;BR /&gt;&lt;BR /&gt;Here is caljd.pl, Version 2.21p.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 22 Sep 2003 17:41:35 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2003-09-22T17:41:35Z</dc:date>
    <item>
      <title>cron on 3rd friday</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075377#M141529</link>
      <description>Hi,&lt;BR /&gt;Is there any way to schedule cron execution on&lt;BR /&gt;every 3rd friday each month ?&lt;BR /&gt;&lt;BR /&gt;so far I'm using:&lt;BR /&gt;0 12 * * 5  /appl/email/suka  &lt;BR /&gt;&lt;BR /&gt;but it's for every friday and shell handles this internally checking for existince some control files.&lt;BR /&gt;&lt;BR /&gt;Thanks all.&lt;BR /&gt;D</description>
      <pubDate>Fri, 19 Sep 2003 17:18:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075377#M141529</guid>
      <dc:creator>Vlad_11</dc:creator>
      <dc:date>2003-09-19T17:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: cron on 3rd friday</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075378#M141530</link>
      <description>There is no way with cron itself to tell it to run the 3rd Friday of each month.&lt;BR /&gt;&lt;BR /&gt;The way you are doing it is probably the best way there is.</description>
      <pubDate>Fri, 19 Sep 2003 17:23:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075378#M141530</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2003-09-19T17:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: cron on 3rd friday</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075379#M141531</link>
      <description>D,&lt;BR /&gt;&lt;BR /&gt;Something like this might do it&lt;BR /&gt;&lt;BR /&gt;0 12 15-21 * 5 /appl/email/suka &lt;BR /&gt;&lt;BR /&gt;Either that or it will give everyone a chance to pick on me for being an idiot (again)!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Sep 2003 17:29:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075379#M141531</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-09-19T17:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: cron on 3rd friday</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075380#M141532</link>
      <description>D,&lt;BR /&gt;&lt;BR /&gt;I'll call myself an idiot first - that would run the job every day from the 15th through the 21st and every friday.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Sep 2003 17:31:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075380#M141532</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-09-19T17:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: cron on 3rd friday</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075381#M141533</link>
      <description>Pete,&lt;BR /&gt;&lt;BR /&gt;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!&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Sep 2003 17:37:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075381#M141533</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2003-09-19T17:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: cron on 3rd friday</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075382#M141534</link>
      <description>What you could do is this:&lt;BR /&gt;&lt;BR /&gt;Run the program every friday.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;outline&lt;BR /&gt;&lt;BR /&gt;#program start&lt;BR /&gt;&lt;BR /&gt;# What friday number is it ???&lt;BR /&gt;&lt;BR /&gt;# If its not the third firday.&lt;BR /&gt;  exit 0;&lt;BR /&gt;else&lt;BR /&gt;  execute desired code.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;&lt;BR /&gt;To find caljd.sh, go to procura's web site.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.cmve.net/~merijn/" target="_blank"&gt;http://www.cmve.net/~merijn/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Attaching my version which is not current.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Sep 2003 17:50:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075382#M141534</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-09-19T17:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: cron on 3rd friday</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075383#M141535</link>
      <description>You can't run on the 15-21 as the month day AND weekday 5 because cron does not AND these conditions but rather it OR's them. What you can do is use your same cron entry to run every Fridate and then a simple test to see if the month day is between 15 and 21 -- the 3rd Friday.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;typeset -i10 DAY=$(date '+%d')&lt;BR /&gt;if [[ ${DAY} -ge 15 &amp;amp;&amp;amp; ${DAY} -le 21 ]]&lt;BR /&gt;then&lt;BR /&gt;  echo "Your commands go here."&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Sep 2003 17:58:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075383#M141535</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-09-19T17:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: cron on 3rd friday</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075384#M141536</link>
      <description>JP,&lt;BR /&gt;&lt;BR /&gt;"Like minds think great" or something like that.&lt;BR /&gt;&lt;BR /&gt;;^)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Sep 2003 17:58:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075384#M141536</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-09-19T17:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: cron on 3rd friday</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075385#M141537</link>
      <description>it might seem like a lot of work, but now you have a very pwoerfull date to julian convertion tool (attached)&lt;BR /&gt;&lt;BR /&gt;use it any sitp that you want to do date manipulation work. such as what you are trying to perform.&lt;BR /&gt;&lt;BR /&gt;or if you want to run a job on the 3rd business day of each month through cron. wierd, not uncommon.&lt;BR /&gt;&lt;BR /&gt;1st step. find out what is the day count for each 3rd friday of the year and record that list.&lt;BR /&gt;&lt;BR /&gt;2nd step, copy this conf tool in you script and source it to do date convertion for you.&lt;BR /&gt;&lt;BR /&gt;DT=`date +%D`&lt;BR /&gt;echo "$DT\nq\n" | date2julian | awk '{print $9}' | read DATE&lt;BR /&gt;echo "$DT" | sed "s/\// /gp" | read M D Y        # today's date&lt;BR /&gt;(( YESTERDAY = $DATE - 1 ))&lt;BR /&gt;echo "$YESTERDAY\nq\n" | date2julian | awk '{print $7}' | read ETAD&lt;BR /&gt;echo "$ETAD" | sed "s/\// /gp" | read MM DD YY    # yesterdays date&lt;BR /&gt;&lt;BR /&gt;once you have this info, you can do the date check.&lt;BR /&gt;&lt;BR /&gt;say your list is 5, 15, 23, 32, etc...&lt;BR /&gt;&lt;BR /&gt;then you want to do a check if this is the 3rd friday of the month.&lt;BR /&gt;&lt;BR /&gt;if [ $DATE = 5 || $DATE = 15 || $DATE = 23 .... ] &lt;BR /&gt;   then&lt;BR /&gt;   echo this is 3rd friday&lt;BR /&gt;    do your job&lt;BR /&gt;   else&lt;BR /&gt;   # not 3rd friday&lt;BR /&gt;   exit 0&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;have fun&lt;BR /&gt;Donny</description>
      <pubDate>Mon, 22 Sep 2003 09:48:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075385#M141537</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-09-22T09:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: cron on 3rd friday</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075386#M141538</link>
      <description>uh-oh, forgot to tell you to add the job in cron to run everyday. this does'nt matter, because the script will determine if it is the correct day.&lt;BR /&gt;&lt;BR /&gt;peace&lt;BR /&gt;Donny</description>
      <pubDate>Mon, 22 Sep 2003 09:49:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075386#M141538</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-09-22T09:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: cron on 3rd friday</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075387#M141539</link>
      <description>Because thisa has been such a frequent request, I've decided to add yet another option, "-N", to caljd.sh. Your cron job should run every Friday but add this test to determine if the current daye is the third Friday [ or any 3rd occurence of a given weekday].&lt;BR /&gt;&lt;BR /&gt;WEEKNO=$(caljd.sh -N)&lt;BR /&gt;if [[ ${WEEKNO} -eq 3 ]]&lt;BR /&gt;then&lt;BR /&gt;echo "3rd Friday; your commands go here"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;To determine if a given date is the 2nd occurrence of the weekday in a month, you could do this test:&lt;BR /&gt;&lt;BR /&gt;WEEKNO=$(caljd.sh -N 9 12 2003)&lt;BR /&gt;if [[ ${WEEKNO} -eq 2 ]]&lt;BR /&gt;then&lt;BR /&gt;echo "2nd"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Invoke as caljd.sh -u for full usage. This is caljd.sh Version 2.21.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Sep 2003 17:40:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075387#M141539</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-09-22T17:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: cron on 3rd friday</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075388#M141540</link>
      <description>Here is the Perl version. The arguments are exactly the same as caljd.sh simply substitute caljd.pl for caljd.sh, if you like.&lt;BR /&gt;&lt;BR /&gt;Here is caljd.pl, Version 2.21p.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Sep 2003 17:41:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-on-3rd-friday/m-p/3075388#M141540</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-09-22T17:41:35Z</dc:date>
    </item>
  </channel>
</rss>

