<?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: Doubt in crontab in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/doubt-in-crontab/m-p/3987234#M295083</link>
    <description>Not directly with cron, however you can run a script every Sunday and then let the script decide if it is the 2nd Sunday and take action or simply exit if not. The attached script, caljd.sh, will make this easy. I'll assume that you install it in /usr/local/bin. You script invoked by cron each Sunday should look very much like this:&lt;BR /&gt;&lt;BR /&gt;------------------------------------------&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;typeset -i STAT=0&lt;BR /&gt;&lt;BR /&gt;export PATH=${PATH}:/usr/local/bin&lt;BR /&gt;&lt;BR /&gt;if [[ $(caljd.sh -N) -eq 2 ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo "2nd Sunday; do your thing."&lt;BR /&gt;    STAT=${?} &lt;BR /&gt;  fi&lt;BR /&gt;exit ${STAT}&lt;BR /&gt;--------------------------------------------&lt;BR /&gt;Here's the caljd.sh attachment; invoke it as caljd.sh -u for full usage and many examples.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 23 Apr 2007 20:27:41 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2007-04-23T20:27:41Z</dc:date>
    <item>
      <title>Doubt in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/doubt-in-crontab/m-p/3987233#M295082</link>
      <description>Hi,&lt;BR /&gt; &lt;BR /&gt;  i want to schedule the cron job in crontab on 2nd sunday of every month.&lt;BR /&gt;&lt;BR /&gt;Is it possible?if so how to do it..&lt;BR /&gt;&lt;BR /&gt;help apperciated .</description>
      <pubDate>Mon, 23 Apr 2007 20:20:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/doubt-in-crontab/m-p/3987233#M295082</guid>
      <dc:creator>Amadeus_1</dc:creator>
      <dc:date>2007-04-23T20:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Doubt in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/doubt-in-crontab/m-p/3987234#M295083</link>
      <description>Not directly with cron, however you can run a script every Sunday and then let the script decide if it is the 2nd Sunday and take action or simply exit if not. The attached script, caljd.sh, will make this easy. I'll assume that you install it in /usr/local/bin. You script invoked by cron each Sunday should look very much like this:&lt;BR /&gt;&lt;BR /&gt;------------------------------------------&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;typeset -i STAT=0&lt;BR /&gt;&lt;BR /&gt;export PATH=${PATH}:/usr/local/bin&lt;BR /&gt;&lt;BR /&gt;if [[ $(caljd.sh -N) -eq 2 ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo "2nd Sunday; do your thing."&lt;BR /&gt;    STAT=${?} &lt;BR /&gt;  fi&lt;BR /&gt;exit ${STAT}&lt;BR /&gt;--------------------------------------------&lt;BR /&gt;Here's the caljd.sh attachment; invoke it as caljd.sh -u for full usage and many examples.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 23 Apr 2007 20:27:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/doubt-in-crontab/m-p/3987234#M295083</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-04-23T20:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Question on crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/doubt-in-crontab/m-p/3987235#M295084</link>
      <description>&lt;!-- !*# --&gt;&lt;P&gt;&amp;gt;Clay: you can run a script every Sunday and then let the script decide if it is the 2nd Sunday&lt;BR /&gt;&lt;BR /&gt;You might want to reverse that and run it for every second week and then have the script test for Sunday. (Even though it fires off 7 days a month instead of 4 or 5, the scripting is easier.)&lt;BR /&gt;&lt;BR /&gt;# The test for Sun is in the script.&lt;BR /&gt;00 05 08-14 * * gen_monthly_status&lt;BR /&gt;&lt;BR /&gt;WD=$(date +"%a")&lt;BR /&gt;if [ $WD != "Sun" ]; then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;If you are worried about locales, you may want to use "%u" and check for 7.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Sep 2011 22:14:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/doubt-in-crontab/m-p/3987235#M295084</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-09-18T22:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Doubt in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/doubt-in-crontab/m-p/3987236#M295085</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;By using cron it is  possible to schedule jobs&lt;BR /&gt;on all Sundays/Weekdays, for schjeduling on Sundays&lt;BR /&gt;&lt;BR /&gt;If u want to schedule a job on every 2nd Sunday,&lt;BR /&gt;u schedule the job to run on all sundays and&lt;BR /&gt;check in the job itself if it is 2nd sunday or not.&lt;BR /&gt;&lt;BR /&gt;eg. &lt;BR /&gt;&lt;BR /&gt;ur cronfile may look like this.&lt;BR /&gt;--------------------------&lt;BR /&gt;0 0 20 * * 0 /&lt;PATH_TO_UR_SCRIPT&gt;&lt;/PATH_TO_UR_SCRIPT&gt;&lt;BR /&gt;--------------------------&lt;BR /&gt;&lt;BR /&gt;Add code to check occurance of Sunday in job.sh&lt;BR /&gt;&lt;BR /&gt;job.sh&lt;BR /&gt;----------&lt;BR /&gt;#! /usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;Day=`date +'%d'`&lt;BR /&gt;Week=`echo "scale=0;($Day + 6) / 7"|bc -l`&lt;BR /&gt;&lt;BR /&gt;if [ $Week -eq 2 ]&lt;BR /&gt;then&lt;BR /&gt; &lt;UR remaining="" part="" of="" script=""&gt;&lt;/UR&gt;fi</description>
      <pubDate>Tue, 24 Apr 2007 00:47:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/doubt-in-crontab/m-p/3987236#M295085</guid>
      <dc:creator>SANTOSH S. MHASKAR</dc:creator>
      <dc:date>2007-04-24T00:47:30Z</dc:date>
    </item>
  </channel>
</rss>

