<?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: HP-UX Cron - run every first thursday of the month in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-cron-run-every-first-thursday-of-the-month/m-p/6799770#M489080</link>
    <description>&lt;P&gt;&amp;gt; Why not respecting the weekday?&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; If cron does day-of-month OR day-of-week (man cron), then it won't do&lt;BR /&gt;day-of-month AND day-of-week.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; The usual solution for problems like this is to get cron to do the&lt;BR /&gt;best it can, and then add tests in the script to skip the unwanted&lt;BR /&gt;cases.&amp;nbsp; For example, tell cron to run the script _every_ Thursday, and&lt;BR /&gt;have the script look for the _first_ Thursday.&amp;nbsp; (Use "date", and look&lt;BR /&gt;for a day-of-month from 1-7.)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; A Forum (or Web) search for keywords like, say:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cron day&lt;BR /&gt;should find many examples.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Oct 2015 13:16:13 GMT</pubDate>
    <dc:creator>Steven Schweda</dc:creator>
    <dc:date>2015-10-06T13:16:13Z</dc:date>
    <item>
      <title>HP-UX Cron - run every first thursday of the month</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-cron-run-every-first-thursday-of-the-month/m-p/6799731#M489079</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to cron something to run every first thursday on the month, but is not working properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;0 10 1-7 * 4 /home/myscript &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so it should run at 10am, between day 1 and 7 of everymonth if weekday is 4 (thursday).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead it is runing everyday if 1-7....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why not respecting the weekday?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2015 11:18:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-cron-run-every-first-thursday-of-the-month/m-p/6799731#M489079</guid>
      <dc:creator>siulogoid</dc:creator>
      <dc:date>2015-10-06T11:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: HP-UX Cron - run every first thursday of the month</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-cron-run-every-first-thursday-of-the-month/m-p/6799770#M489080</link>
      <description>&lt;P&gt;&amp;gt; Why not respecting the weekday?&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; If cron does day-of-month OR day-of-week (man cron), then it won't do&lt;BR /&gt;day-of-month AND day-of-week.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; The usual solution for problems like this is to get cron to do the&lt;BR /&gt;best it can, and then add tests in the script to skip the unwanted&lt;BR /&gt;cases.&amp;nbsp; For example, tell cron to run the script _every_ Thursday, and&lt;BR /&gt;have the script look for the _first_ Thursday.&amp;nbsp; (Use "date", and look&lt;BR /&gt;for a day-of-month from 1-7.)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; A Forum (or Web) search for keywords like, say:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cron day&lt;BR /&gt;should find many examples.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2015 13:16:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-cron-run-every-first-thursday-of-the-month/m-p/6799770#M489080</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2015-10-06T13:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: HP-UX Cron - run every first thursday of the month</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-cron-run-every-first-thursday-of-the-month/m-p/6799859#M489081</link>
      <description>&lt;P&gt;Added in the top of the script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;chk_day=`date +%a`&lt;BR /&gt;if [ $chk_day = 'Thu' ];&lt;BR /&gt;then&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;my code&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;else&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;exit 0;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;fi&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kept in the cron every 1-7 day in each month.&lt;/P&gt;&lt;P&gt;and it seems it is working.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2015 16:39:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-cron-run-every-first-thursday-of-the-month/m-p/6799859#M489081</guid>
      <dc:creator>siulogoid</dc:creator>
      <dc:date>2015-10-06T16:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: HP-UX cron - run every first thursday of the month</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-cron-run-every-first-thursday-of-the-month/m-p/6799924#M489082</link>
      <description>&lt;P&gt;&amp;gt;Kept in the cron every 1-7 day in each month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, that makes the script easier.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;chk_day=`date +%a`&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're worried about locales, you may want a day of the week in numeric format:&lt;/P&gt;&lt;P&gt;chk_day=$(date +%u)&amp;nbsp; # 1 - 7 Mon .. Sun&lt;/P&gt;&lt;P&gt;if [ $chk_day != 4 ]; then # Thu&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; exit # if not Thursday, exit&lt;/P&gt;&lt;P&gt;fi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you have comments in both crontab and the script to indicate how they work together.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2015 18:42:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-cron-run-every-first-thursday-of-the-month/m-p/6799924#M489082</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2015-10-06T18:42:13Z</dc:date>
    </item>
  </channel>
</rss>

