- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: crontab log
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
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
12-09-2012 07:21 PM
12-09-2012 07:21 PM
crontab log
how to check my cron job running status
- Tags:
- cron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2012 07:57 AM
12-10-2012 07:57 AM
Re: crontab log
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 <username>") to see if it is currently running.
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/<username>).
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:
echo "$$" >/some/file.pid
This creates a pid file for the job, which allows you to make several checks:
- If /some/file.pid exists, the cron job has been started at least once
- the timestamp of the file will tell you the last time the cron job actually started
- "ps -fp $(</some/file.pid)" will list the cron job process if it is still running
- if you need some other script to know if the cron job is currently running, you can do it like this:
#!/bin/sh # kill -0 only tests if a given PID exists if kill -0 $(</some/file.pid); then echo "Yes, the job is still running." else echo "No, the job is not running right now." fi
- Tags:
- kill