- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- process ID of a cronjob
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp
Knowledge Base
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2002 09:24 AM
11-04-2002 09:24 AM
Our hosted company just setup openview alert for all our production servers, one of the alert is when a cronjob failed for any reason, I will get a message from OV server telling me a cron command with pid "xxxx" failed, and rc=xxx.
the problem is we have lots of cronjobs running on the server, and the OV message itself doesn't have timestamp, the only time tag I got is the time I received the mail, which does not accurately match the server time. So it's hard for me to find out which cronjob failed.
I'm just wondering, if I put "echo $$" at the begining of all cronjob scripts(some scripts are complicated, they call other scripts), will that match the PID indicated at the OV message?
thanks,
Gary
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2002 09:28 AM
11-04-2002 09:28 AM
Re: process ID of a cronjob
echo "${$}: File Purge Program" > ${LOGFILE}
date >> ${LOGFILE}
will do rather well for your purposes.
Or a syslog message could be used as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2002 09:39 AM
11-04-2002 09:39 AM
Re: process ID of a cronjob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2002 11:48 AM
11-04-2002 11:48 AM
Re: process ID of a cronjob
I wonder whether openview alert is just looking at cron's log file '/var/adm/cron/log'.
This lists the command run, process id, time and result code (if non zero). The process id is going to be the parent id of your process as cron calls it with an su. You could try logging ${PPID} in your script and it should tie up with the one logged by cron.
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2002 12:24 PM
11-04-2002 12:24 PM
Re: process ID of a cronjob
thanks,
Gary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2002 12:34 PM
11-04-2002 12:34 PM
Re: process ID of a cronjob
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2002 01:39 PM
11-04-2002 01:39 PM
SolutionI remembered reading some posts about the return codes from cron. I did a search and found a couple of threads that talk about them. You can also look at /usr/include/sys/errno.h to see the return codes used.
Good luck!
JP
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xce8093e260b0d611abdb0090277a778c,00.html
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x982beea29889d611abdb0090277a778c,00.html