Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Monitor ruby processes with Monit

I have a bunch of Ruby scripts which are long running, I'd like to ensure that every 30 seconds or so these are up.

I normally start the commands by simply ruby script-name.rb

How can I configure monit to look after these scripts?

Update: I tried to follow this method to create a wrapper script which would then launch the ruby process but it did not seem to create the .pid file and typing './wrapper-script stop' did nothing :/

Should I write the pid inside ruby or use a wrapper script to create the pid necessary for monit?

like image 443
Tom Avatar asked Jan 10 '11 20:01

Tom


1 Answers

The Monit Wiki has a lot of configuration examples:

http://mmonit.com/wiki/Monit/ConfigurationExamples

Just pick a simple one and modify it according to your needs.

Update: the wrapper script should create the pid for you in this line:

echo $$ > /var/run/xyz.pid;

Did you adapt the script to your needs? Is it executable (chmod +x)? Does it have write permissions for the destination? Maybe post the wrapper you are trying to use so I can help you more.

like image 127
Michael Kohl Avatar answered Sep 20 '22 03:09

Michael Kohl