<?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 find cron freeze/hung status? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366399#M194902</link>
    <description>Hi Deva,&lt;BR /&gt;&lt;BR /&gt;Another idea would be to have the cron jobs log their activity and output to a log file, or series of log files, and then you should be able to check the log files each morning to see what executed.  &lt;BR /&gt;&lt;BR /&gt;I recommend at least adding some print statements to the beginning and end of the cron jobs, but if you have the time and energy, you can add more print jobs at critical points during the cron job so that the log file will show the activity of the job as it progresses.  &lt;BR /&gt;&lt;BR /&gt;Depending upon how well you instrument (i.e. add print statements) your cron jobs, this logging information will also help you pin point exactly where a problem in the job occurred; or - in the case of a job hang - at what point the job hung.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dave</description>
    <pubDate>Thu, 26 Aug 2004 21:22:14 GMT</pubDate>
    <dc:creator>Dave Olker</dc:creator>
    <dc:date>2004-08-26T21:22:14Z</dc:date>
    <item>
      <title>how to find cron freeze/hung status?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366397#M194900</link>
      <description>Hi,&lt;BR /&gt;I have few jobs are running under cron in HPUx box. how can i find If cron job hungs/freeze?&lt;BR /&gt;I have Cron process monitoring.., i am still wondering some times cron process shows in ps -ef |grep &lt;BR /&gt;but it wont run any sheduled cron jobs..,&lt;BR /&gt;&lt;BR /&gt;does anyone has any logic to share with me?&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Deva</description>
      <pubDate>Thu, 26 Aug 2004 19:45:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366397#M194900</guid>
      <dc:creator>Deva_1</dc:creator>
      <dc:date>2004-08-26T19:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to find cron freeze/hung status?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366398#M194901</link>
      <description>The first place to look is in the cron log. This will tell if the job has been submitted. If you find "rc=??" it may not have run at all. Normally cron does not hang, but may terminate, so there would be no process at all.&lt;BR /&gt;&lt;BR /&gt;Log is in /var/adm/cron/log</description>
      <pubDate>Thu, 26 Aug 2004 19:47:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366398#M194901</guid>
      <dc:creator>Michael Tully</dc:creator>
      <dc:date>2004-08-26T19:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to find cron freeze/hung status?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366399#M194902</link>
      <description>Hi Deva,&lt;BR /&gt;&lt;BR /&gt;Another idea would be to have the cron jobs log their activity and output to a log file, or series of log files, and then you should be able to check the log files each morning to see what executed.  &lt;BR /&gt;&lt;BR /&gt;I recommend at least adding some print statements to the beginning and end of the cron jobs, but if you have the time and energy, you can add more print jobs at critical points during the cron job so that the log file will show the activity of the job as it progresses.  &lt;BR /&gt;&lt;BR /&gt;Depending upon how well you instrument (i.e. add print statements) your cron jobs, this logging information will also help you pin point exactly where a problem in the job occurred; or - in the case of a job hang - at what point the job hung.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dave</description>
      <pubDate>Thu, 26 Aug 2004 21:22:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366399#M194902</guid>
      <dc:creator>Dave Olker</dc:creator>
      <dc:date>2004-08-26T21:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to find cron freeze/hung status?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366400#M194903</link>
      <description>Deva,&lt;BR /&gt;&lt;BR /&gt;indeed you can use cron's logfile. It's a bit hard to read though. It's not difficult to find jobs that ended abnormally ('rc= ' lines) but it may be difficult for you to find which jobs have not ended at all.&lt;BR /&gt;&lt;BR /&gt;The problem is within the jobs itself. They should be well-written. For example they should use exit codes.&lt;BR /&gt;&lt;BR /&gt;I also remember someone wrote a C-program that will start a job and kill it or send an alert if the job does not finish within a certain period.&lt;BR /&gt;&lt;BR /&gt;I always found the cron daemon to be reliable. Do you really have cron jobs that don't get scheduled by the cron daemon? Can you give us examples? Will the job never be run? Can you give us the 'crontab -l' output and a part of the cron logfile?&lt;BR /&gt;&lt;BR /&gt;JP.</description>
      <pubDate>Fri, 27 Aug 2004 01:58:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366400#M194903</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-08-27T01:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to find cron freeze/hung status?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366401#M194904</link>
      <description>Hi All,&lt;BR /&gt;Thanks  for the Inputs,&lt;BR /&gt;&lt;BR /&gt;I would like to develop a script to monitor the cron process state (i.e. when it is in hung state) and also when is not updating cron logfiles, which means it is not executing any of the schedule jobs.&lt;BR /&gt;&lt;BR /&gt;Sometimes, cron process will be running but it never runs scheduled cron jobs and also never updates cron logfiles&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; Regards&lt;BR /&gt;&lt;BR /&gt;Dev</description>
      <pubDate>Fri, 27 Aug 2004 02:19:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366401#M194904</guid>
      <dc:creator>Deva_1</dc:creator>
      <dc:date>2004-08-27T02:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to find cron freeze/hung status?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366402#M194905</link>
      <description>One thing to be aware of with cron is that it imposes limits on the number of jobs that it has running concurrently. Check the man pages for details.&lt;BR /&gt;&lt;BR /&gt;If you use cron to start jobs which run for a long time you can get into the state where cron won't start a new job until one of the current ones has finished. You can get round this by increasing the concurrent limit (see man pages) or possibly by changing the way your long running jobs work. Get the script that cron runs to kick off the real batch job and then exit for instance.&lt;BR /&gt;&lt;BR /&gt;You can check what current cron jobs are active with the ps command. First find out the PID of the cron process ps -ef|grep cron. Then run ps to find processes whose PPID (parent process id) is that of cron.&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;John</description>
      <pubDate>Fri, 27 Aug 2004 03:20:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366402#M194905</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2004-08-27T03:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to find cron freeze/hung status?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366403#M194906</link>
      <description>To monitor whether cron is working: -&lt;BR /&gt;&lt;BR /&gt;Have a script that runs via cron every 15 minutes that does: -&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;if [ ! -f /tmp/cronmonitor.log.last ]; then&lt;BR /&gt;  touch /tmp/cronmonitor.log.last&lt;BR /&gt;fi&lt;BR /&gt;date &amp;gt;&amp;gt; /tmp/cronmonitor.log&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;schedule it in cron with: -&lt;BR /&gt;&lt;BR /&gt;0,15,30,45 * * * /usr/local/bin/cronmonitor.sh&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Then have another script running permanantly in the background that does: -&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while [ true ]; do&lt;BR /&gt;  diff /tmp/cronmonitor.log /tmp/cronmonitor.log.last 2&amp;gt;&amp;amp;1 &amp;gt;/dev/null&lt;BR /&gt;  if [ $? -eq 0 ]; then&lt;BR /&gt;    echo "cron has stopped working" | mailx -s "CRON Failure" you@youraddress.com&lt;BR /&gt;  fi&lt;BR /&gt;  cp /tmp/cronmonitor.log /tmp/cronmonitor.log.last&lt;BR /&gt;  sleep 1800&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;What this will do is change the cronmonitor.log every 15 minutes via cron.  The other script will check every 30 minutes with diff that there has been a change.  if there hasn't, it'll send an email.  when it's checked it copies cronmonitor.log to cronmonitor.log.last to reference in the diff for the next check.&lt;BR /&gt;&lt;BR /&gt;Simple but effective.</description>
      <pubDate>Fri, 27 Aug 2004 03:35:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366403#M194906</guid>
      <dc:creator>Simon Hargrave</dc:creator>
      <dc:date>2004-08-27T03:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to find cron freeze/hung status?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366404#M194907</link>
      <description>Personally, I've always found cron to be very reliable. On many occasions I've had to have checker scripts for ddodgy applications but never for cron itself.</description>
      <pubDate>Fri, 27 Aug 2004 03:39:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366404#M194907</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2004-08-27T03:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to find cron freeze/hung status?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366405#M194908</link>
      <description>Why not have a cron job to periodically restart the cron daemon :) :) :)&lt;BR /&gt;&lt;BR /&gt;Seriously though, as John says I've not really had reliability problems with the cron daemon itself.</description>
      <pubDate>Fri, 27 Aug 2004 03:40:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366405#M194908</guid>
      <dc:creator>Simon Hargrave</dc:creator>
      <dc:date>2004-08-27T03:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to find cron freeze/hung status?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366406#M194909</link>
      <description>Set all your jobs in cron to output to a log file first:&lt;BR /&gt;&lt;BR /&gt;Most people do this:&lt;BR /&gt;&lt;BR /&gt;# Run the sysinfo script&lt;BR /&gt;0 6 1 * * /usr/local/sysinfo/sysinfo -a -b -o /usr/tmp/`hostname`.sysinfo &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;Instead do this:&lt;BR /&gt;&lt;BR /&gt;# Run the sysinfo script&lt;BR /&gt;0 6 1 * * /usr/local/sysinfo/sysinfo -a -b -o /usr/tmp/`hostname`.sysinfo &amp;gt;/tmp/sysinfo.cron 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;Then, after cron hangs, check all the /tmp/*.cron files for errors...&lt;BR /&gt;&lt;BR /&gt;The other thing to check - patches - what OS are you at and are you uptodate with patches?&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Aug 2004 07:33:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366406#M194909</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2004-08-27T07:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to find cron freeze/hung status?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366407#M194910</link>
      <description>Deva,&lt;BR /&gt;&lt;BR /&gt;As other people pointed out you can write some programs to monitor cron's behavior. &lt;BR /&gt;&lt;BR /&gt;I would suggest you only write these programs to find the root cause of your problem, such that in the end you don't need those additional programs any more. Under normal conditions cron should just work without any problems...&lt;BR /&gt; &lt;BR /&gt;JP.</description>
      <pubDate>Fri, 27 Aug 2004 08:00:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366407#M194910</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-08-27T08:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to find cron freeze/hung status?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366408#M194911</link>
      <description>cron simply runs. It schedules the job but does NOT run it. That is a job for the shell, interpreter or the program. How do you know that cron did not run a job? Any job that has errors may abort immediately and cron just keeps running. Start with root's email: are there a bunch of cron error messages? Look at cron's log to see that each job was actually started. Most cron problems are due to wrong environments. Your script runs fine when you are logged in but cron never logs in and has a VERY small environment. The lack of customary values usually causes scripts to fail because they assume a full environment. If you really want to verify that a script has run, use logger at the beginning of the script, something like this:&lt;BR /&gt; &lt;BR /&gt;logger -p local5.info -t cronchecker "$0 has been started"</description>
      <pubDate>Fri, 27 Aug 2004 08:13:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-find-cron-freeze-hung-status/m-p/3366408#M194911</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2004-08-27T08:13:27Z</dc:date>
    </item>
  </channel>
</rss>

