<?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: How to make a cron task holiday aware? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980031#M122004</link>
    <description>Last time this came up I noted that we actually kill the cron daemon with a cron job at a particular time.&lt;BR /&gt;&lt;BR /&gt;Then I have to log in durig the holiday and restart the daemon.&lt;BR /&gt;&lt;BR /&gt;That's hardly fair is it?&lt;BR /&gt;&lt;BR /&gt;What I have done is make the scripts themselves holiday aware.&lt;BR /&gt;&lt;BR /&gt;They have date checking against a holiday list and most of them self terminate on that basis.&lt;BR /&gt;&lt;BR /&gt;cron is stupid, it runs the way you program it. It is the servant of the systems administrator, only as smart as the admin makes it.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
    <pubDate>Thu, 22 May 2003 16:28:11 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2003-05-22T16:28:11Z</dc:date>
    <item>
      <title>How to make a cron task holiday aware?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980027#M122000</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Nobody will be here Monday (Memorial Day) to change backup tapes. Is there a way to have cron not run the tasks on holidays? &lt;BR /&gt;&lt;BR /&gt;TIA, David&lt;BR /&gt;</description>
      <pubDate>Thu, 22 May 2003 16:12:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980027#M122000</guid>
      <dc:creator>David Yandry</dc:creator>
      <dc:date>2003-05-22T16:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a cron task holiday aware?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980028#M122001</link>
      <description>David,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Search results:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x6e219607df6ed711abdc0090277a778c,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x6e219607df6ed711abdc0090277a778c,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xab076049dbb6d611abdb0090277a778c,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xab076049dbb6d611abdb0090277a778c,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;and others.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Thu, 22 May 2003 16:16:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980028#M122001</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-05-22T16:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a cron task holiday aware?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980029#M122002</link>
      <description>Not really, but you could modify your task easily enough to check for the existance of a "holiday" file.  You can use cron to create/remove the /tmp/holiday file&lt;BR /&gt;&lt;BR /&gt;ex.&lt;BR /&gt;&lt;BR /&gt;touch /tmp/holiday&lt;BR /&gt;&lt;BR /&gt;if [ -f /tmp/holiday ]; then&lt;BR /&gt;   exit #...take the day off!&lt;BR /&gt;fi</description>
      <pubDate>Thu, 22 May 2003 16:16:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980029#M122002</guid>
      <dc:creator>James A. Donovan</dc:creator>
      <dc:date>2003-05-22T16:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a cron task holiday aware?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980030#M122003</link>
      <description>Somebody always asks this before holidays. A search on "holiday" and "cron" would almost certainly turn up an answer.&lt;BR /&gt;&lt;BR /&gt;The direct answer to your question is "NO"; cron don't know nothing about no holidays. The tasks themselves will have to determine if today is a holiday and, if so, exit.&lt;BR /&gt;&lt;BR /&gt;There is a seldom used file, /etc/acct/holidays that you need to update then caljd.sh can handle the task.&lt;BR /&gt;&lt;BR /&gt;In your croned script:&lt;BR /&gt;&lt;BR /&gt;if [[ $(caljd.sh) -ne $(caljd.sh -h) ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo "Today is a holiday"&lt;BR /&gt;    exit 0&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;# otherwise continue with task&lt;BR /&gt;&lt;BR /&gt;You will probably need to use caljd.sh to calculate the day offsets for the holidays file. I suggest that you actually create a holidays_2003 file and symbolically link it to the holidays file. Caljd.sh will preferentially use the _YYYY file and you just might need to skip over New Year's eve and New Year's Day. The standard holidays file won't handle that.&lt;BR /&gt;&lt;BR /&gt;You should be able to search and find a copy of caljd.sh (or caljd.pl if you prefer). Make sure that you get version 2.1; it's the latest.&lt;BR /&gt;&lt;BR /&gt;Invoke as caljd.sh -u for full usage and an explanation of the -h switch.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 22 May 2003 16:20:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980030#M122003</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-05-22T16:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a cron task holiday aware?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980031#M122004</link>
      <description>Last time this came up I noted that we actually kill the cron daemon with a cron job at a particular time.&lt;BR /&gt;&lt;BR /&gt;Then I have to log in durig the holiday and restart the daemon.&lt;BR /&gt;&lt;BR /&gt;That's hardly fair is it?&lt;BR /&gt;&lt;BR /&gt;What I have done is make the scripts themselves holiday aware.&lt;BR /&gt;&lt;BR /&gt;They have date checking against a holiday list and most of them self terminate on that basis.&lt;BR /&gt;&lt;BR /&gt;cron is stupid, it runs the way you program it. It is the servant of the systems administrator, only as smart as the admin makes it.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 22 May 2003 16:28:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980031#M122004</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-05-22T16:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a cron task holiday aware?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980032#M122005</link>
      <description>David&lt;BR /&gt;&lt;BR /&gt;Why not just leave the tapes in and let the next backup over write them?&lt;BR /&gt;&lt;BR /&gt;Paula</description>
      <pubDate>Thu, 22 May 2003 17:12:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980032#M122005</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2003-05-22T17:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a cron task holiday aware?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980033#M122006</link>
      <description>Hi  Paula,&lt;BR /&gt;&lt;BR /&gt;That was my first thought but it was shot down as not being ISO 9000 compliant. It seems that if a backup tape is marked 'Monday' it better damn well have only Monday's data on it.&lt;BR /&gt;&lt;BR /&gt;Hi Clay,&lt;BR /&gt;&lt;BR /&gt;You hinted that I could use caljd.sh to set the values in the holidays file. Could you please post an example.&lt;BR /&gt;&lt;BR /&gt;Thanks, David</description>
      <pubDate>Thu, 22 May 2003 19:24:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980033#M122006</guid>
      <dc:creator>David Yandry</dc:creator>
      <dc:date>2003-05-22T19:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a cron task holiday aware?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980034#M122007</link>
      <description>Okay, I'll give you a hint. I actually have ascript to calculate the offsets. You feed it month, day, and year of the holiday and it spits out the number of days since Jan. 1st of the same year plus 1 - which is the offset value that the holidays file expects.&lt;BR /&gt;&lt;BR /&gt;Here is July 4th, 2003&lt;BR /&gt;&lt;BR /&gt;OFFSET=$(($(caljd.sh 7 4 2003) - $(caljd.sh 1 1 2003) + 1))&lt;BR /&gt;echo "Offset: ${OFFSET}"&lt;BR /&gt;</description>
      <pubDate>Thu, 22 May 2003 19:33:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980034#M122007</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-05-22T19:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a cron task holiday aware?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980035#M122008</link>
      <description>Hi David,&lt;BR /&gt;1&amp;gt; If you know the list of holidays in the year, simply create a file in your favourite location, having the dates.&lt;BR /&gt;2&amp;gt; In the beginning of your script, just put a simple "if", asking it to check the presence of today's date in the "holiday" file. If today is a holiday, let the script exit there it self.&lt;BR /&gt;3&amp;gt; This would be one time job per year, and you can enjoy your holidays without worrying about the scheduled job.&lt;BR /&gt;4&amp;gt; This would safe-guard the interest of other scheduled jobs as well.&lt;BR /&gt;&lt;BR /&gt;Hope this helps...&lt;BR /&gt;&lt;BR /&gt;Regards..&lt;BR /&gt;Suhas&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 23 May 2003 03:15:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-make-a-cron-task-holiday-aware/m-p/2980035#M122008</guid>
      <dc:creator>Suhas_2</dc:creator>
      <dc:date>2003-05-23T03:15:13Z</dc:date>
    </item>
  </channel>
</rss>

