<?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: crontab log in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-log/m-p/5895173#M482571</link>
    <description>&lt;P&gt;If your cron job does not do anything to make itself easier to find, your options are to read the cron logfile (/var/adm/cron/log) or use the ps command (like "ps -fu &amp;lt;username&amp;gt;") to see if it is currently running.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you don't redirect the standard output and/or standard error output of the cron job, the output will by default be mailed to you (if the mail system has default configuration, it will end up to your local email inbox file, /var/mail/&amp;lt;username&amp;gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your cron job is a script, you can make it easier to find by adding a command like this to the beginning of the script:&lt;/P&gt;&lt;PRE&gt;echo "$$" &amp;gt;/some/file.pid&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This creates a pid file for the job, which allows you to make several checks:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If /some/file.pid exists, the cron job has been started at least once&lt;/LI&gt;&lt;LI&gt;the timestamp of the file will tell you the last time the cron job actually started&lt;/LI&gt;&lt;LI&gt;"ps -fp $(&amp;lt;/some/file.pid)" will list the cron job process if it is still running&lt;/LI&gt;&lt;LI&gt;if you need some other script to know if the cron job is currently running, you can do it like this:&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;#!/bin/sh

# kill -0 only tests if a given PID exists
if kill -0 $(&amp;lt;/some/file.pid); then
    echo "Yes, the job is still running."
else
    echo "No, the job is not running right now."
fi&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Dec 2012 15:57:46 GMT</pubDate>
    <dc:creator>Matti_Kurkela</dc:creator>
    <dc:date>2012-12-10T15:57:46Z</dc:date>
    <item>
      <title>crontab log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-log/m-p/5894501#M482566</link>
      <description>&lt;P&gt;how to check my cron job running status&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2012 03:21:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-log/m-p/5894501#M482566</guid>
      <dc:creator>rajesh73</dc:creator>
      <dc:date>2012-12-10T03:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: crontab log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-log/m-p/5895173#M482571</link>
      <description>&lt;P&gt;If your cron job does not do anything to make itself easier to find, your options are to read the cron logfile (/var/adm/cron/log) or use the ps command (like "ps -fu &amp;lt;username&amp;gt;") to see if it is currently running.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you don't redirect the standard output and/or standard error output of the cron job, the output will by default be mailed to you (if the mail system has default configuration, it will end up to your local email inbox file, /var/mail/&amp;lt;username&amp;gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your cron job is a script, you can make it easier to find by adding a command like this to the beginning of the script:&lt;/P&gt;&lt;PRE&gt;echo "$$" &amp;gt;/some/file.pid&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This creates a pid file for the job, which allows you to make several checks:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If /some/file.pid exists, the cron job has been started at least once&lt;/LI&gt;&lt;LI&gt;the timestamp of the file will tell you the last time the cron job actually started&lt;/LI&gt;&lt;LI&gt;"ps -fp $(&amp;lt;/some/file.pid)" will list the cron job process if it is still running&lt;/LI&gt;&lt;LI&gt;if you need some other script to know if the cron job is currently running, you can do it like this:&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;#!/bin/sh

# kill -0 only tests if a given PID exists
if kill -0 $(&amp;lt;/some/file.pid); then
    echo "Yes, the job is still running."
else
    echo "No, the job is not running right now."
fi&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2012 15:57:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-log/m-p/5895173#M482571</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2012-12-10T15:57:46Z</dc:date>
    </item>
  </channel>
</rss>

