# How to monitor Cron jobs?

**URL:** <https://www.ruby-forum.com/t/how-to-monitor-cron-jobs/192575>\
**Category:** Rails\
**Created:** [August 2, 2010, 2:55pm UTC](https://www.ruby-forum.com/t/how-to-monitor-cron-jobs/192575 "2010-08-02T14:55:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PierreW](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/da6949/32.png) [@PierreW](https://www.ruby-forum.com/u/PierreW)\
**Post date:** [August 2, 2010, 2:55pm UTC](https://www.ruby-forum.com/t/how-to-monitor-cron-jobs/192575/1 "2010-08-02T14:55:43Z")

</div>

Hi guys,

I understand how to monitor long running processes with monit or god,  
but I don’t understand how to monitor Cron jobs (for memory bloating  
notably) since such processes

- always have different PIDs when they start
- are precisely supposed to stop when they are done, then restart when  
asked (vs running all the time).

I have been looking on the web for a while, but didn’t find any simple  
way. Is there a recommended “basic strategy” to monitor Cron jobs?

Thanks!  
Pierre

---

<div class="post-metadata">

**Author:** ![PierreW](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/da6949/32.png) [@PierreW](https://www.ruby-forum.com/u/PierreW)\
**Post date:** [August 2, 2010, 3:20pm UTC](https://www.ruby-forum.com/t/how-to-monitor-cron-jobs/192575/2 "2010-08-02T15:20:19Z")

</div>

When the process starts, or when it is started by a wrapper, the  
process writes it’s pid to a file such as /var/run/my\_app.pid

As the pid is always written to the same file monit can read the file  
and find the pid of the process and check that there is a process with  
that pid running.

---

<div class="post-metadata">

**Author:** ![PierreW](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/da6949/32.png) [@PierreW](https://www.ruby-forum.com/u/PierreW)\
**Post date:** [August 2, 2010, 9:06pm UTC](https://www.ruby-forum.com/t/how-to-monitor-cron-jobs/192575/3 "2010-08-02T21:06:23Z")

</div>

Thanks Peter.

One thing though: my script/runner doesn’t seem to write a PID file  
(or at least I can’t locate it in the “typical” places - it might be a  
right issue). Is there a possibility to manually specify a PID file  
(either a runner option, or a shell command)? I can’t find such  
option…

Pierre
