<?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 scheduling in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871952#M398917</link>
    <description>cal|egrep -v "2004|^$"|cut -c19-20|grep -v "^$"|head -2|tail -1&lt;BR /&gt;&lt;BR /&gt;Gives you the date of the first Saturday. Put this in a script. Now run your cron on every saturday. If the date is "date received by above command", then run the job, else not.&lt;BR /&gt;&lt;BR /&gt;Also set cron as follows.&lt;BR /&gt;&lt;BR /&gt;00 05 * * 6 myjob&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Anil</description>
    <pubDate>Tue, 23 Nov 2004 12:13:15 GMT</pubDate>
    <dc:creator>RAC_1</dc:creator>
    <dc:date>2004-11-23T12:13:15Z</dc:date>
    <item>
      <title>cron scheduling</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871949#M398914</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I want to schedule a job with cron, and have it run every first saturday of each month. To do so, I used this settings :&lt;BR /&gt;00 05 1-6 * 6 myjob&lt;BR /&gt;I expect this setting to run myjob each saturday, between the 1 and the 6 of the month, wich is equivalent to first saturday.&lt;BR /&gt;&lt;BR /&gt;But it doesn't act so. It runs every saturday of the month AND every day between the 1 and 6 of the month. Is this normal behaviour ?&lt;BR /&gt;&lt;BR /&gt;System is 11.00 64 bits with march 2003 quality pack patches.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;swlist -l patch | grep cron&lt;BR /&gt;# PHCO_21494                            1.0            Cumulative cron/at/crontab patch&lt;BR /&gt;# PHCO_22767                            1.0            cumulative crontab/at/cron patch&lt;BR /&gt;# PHCO_27141                            1.0            cumulative crontab/at/cron patch&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Nov 2004 12:02:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871949#M398914</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-11-23T12:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: cron scheduling</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871950#M398915</link>
      <description>Hi Fred,&lt;BR /&gt;&lt;BR /&gt;this is quite normal. &lt;BR /&gt;&lt;BR /&gt;cron behaviour is cumulative. It runs on the specified days,&lt;BR /&gt;&lt;BR /&gt;Try this link for s similar sitation as yours,&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=535974" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=535974&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Regds&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Nov 2004 12:09:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871950#M398915</guid>
      <dc:creator>Sanjay_6</dc:creator>
      <dc:date>2004-11-23T12:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: cron scheduling</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871951#M398916</link>
      <description>I think the behavior is normal.&lt;BR /&gt;&lt;BR /&gt;The way to accomplish this is to run the job every Saturday.&lt;BR /&gt;&lt;BR /&gt;Then use the magic &lt;A href="http://www.hpux.ws/merjin/caljd.sh" target="_blank"&gt;http://www.hpux.ws/merjin/caljd.sh&lt;/A&gt; script by A. Clay to figure out if its really the first Saturday of the month and to continue execution.&lt;BR /&gt;&lt;BR /&gt;Thats how I handle it.&lt;BR /&gt;&lt;BR /&gt;The script is very well documented.'&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 23 Nov 2004 12:10:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871951#M398916</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-11-23T12:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: cron scheduling</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871952#M398917</link>
      <description>cal|egrep -v "2004|^$"|cut -c19-20|grep -v "^$"|head -2|tail -1&lt;BR /&gt;&lt;BR /&gt;Gives you the date of the first Saturday. Put this in a script. Now run your cron on every saturday. If the date is "date received by above command", then run the job, else not.&lt;BR /&gt;&lt;BR /&gt;Also set cron as follows.&lt;BR /&gt;&lt;BR /&gt;00 05 * * 6 myjob&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Tue, 23 Nov 2004 12:13:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871952#M398917</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-11-23T12:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: cron scheduling</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871953#M398918</link>
      <description>Patches aren't your problem this is pilot error. When you list monthdays and weekdays in your crontab the result is a logical OR rather than a logical AND.&lt;BR /&gt;&lt;BR /&gt;What you need to do is run your command every Saturday and let your script itself determine if this is the 1st Saturday. Let's see, this sounds like a date problem. I wonder which tool I'll use?&lt;BR /&gt;&lt;BR /&gt;In your script that fires off each Sat. do something like this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;PATH=${PATH}:/usr/local/bin&lt;BR /&gt;export PATH&lt;BR /&gt;&lt;BR /&gt;if [[ $(caljd.sh -N) -eq 1 ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo "1st occurence in the Month; do your thing."&lt;BR /&gt;  else&lt;BR /&gt;    echo "It ain't; do nothing"&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;Invoke as caljd.sh -u for full usage and what this does.&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Nov 2004 12:13:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871953#M398918</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-11-23T12:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: cron scheduling</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871954#M398919</link>
      <description>Thanks,&lt;BR /&gt;&lt;BR /&gt;I should have guess caljd was to mentionned on such a thread :)&lt;BR /&gt;&lt;BR /&gt;Not that it's not that I don't like your script, but I find it a little bit simplier to set in cron&lt;BR /&gt;00 05 1-6 * * myjob&lt;BR /&gt;and start my script with a test on "date +%u"&lt;BR /&gt;&lt;BR /&gt;Thanks again for making clear this point about cron using OR and not AND...&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Nov 2004 12:33:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-scheduling/m-p/4871954#M398919</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-11-23T12:33:28Z</dc:date>
    </item>
  </channel>
</rss>

