Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

God won't register a running custom service

I've got a rails website and a small minecraft server running on a linode vps. I'm running minecraft as a custom service off of a ram server based on an init.d file. Since I'm using God to monitor my rails website I thought I'd use it for minecraft as well, but it doesn't seem to be able to recognize the service in any way. The conditions don't detect its presence. :process_running always returns false, whether it's running or not, and fail to start it when it isn't. To add to the confusion :memory_usage and :cpu_usage are always zero.

My /etc/init.d/minecraft file is here: http://pastie.org/2760483

It works perfectly well, and 'service minecraft start' and whatnot gives me pretty much everything I need. My hope was to be able to put it to sleep it automatically through god whenever the cpu usage got high to prioritize the website. However none of the god conditions are figuring out what's going on with the process.

My /opt/god/minecraft.god file is here: http://pastie.org/2760498

Obviously the low cpu in that is an attempt to get a rise out of god. Asking for a smiting, if you will.

Trying to run god off the config: sudo god -c minecraft.god -D

yields:

I [2011-10-26 01:55:55]  INFO: Loading minecraft.god
I [2011-10-26 01:55:55]  INFO: Syslog enabled.
I [2011-10-26 01:55:55]  INFO: Using pid file directory: /var/run/god
I [2011-10-26 01:55:55]  INFO: Socket already in use
I [2011-10-26 01:55:55]  INFO: Socket is stale, reopening
I [2011-10-26 01:55:55]  INFO: Started on drbunix:///tmp/god.17165.sock
I [2011-10-26 01:55:55]  INFO: minecraft move 'unmonitored' to 'up'
I [2011-10-26 01:55:55]  INFO: minecraft moved 'unmonitored' to 'up'
I [2011-10-26 01:55:55]  INFO: minecraft [ok] memory within bounds [0kb] (MemoryUsage)
I [2011-10-26 01:55:55]  INFO: minecraft [ok] cpu within bounds [0%%] (CpuUsage)
like image 498
chrisk Avatar asked Oct 26 '11 06:10

chrisk


1 Answers

As far as I can tell the problem you're having is that you're not supplying god with a pidfile. As quoted from the god webpage:

If the process you're watching runs as a daemon (as mine does), you'll need to set the pid_file attribute.

Full text here: http://god.rubyforge.org/

like image 162
thomasfedb Avatar answered Sep 27 '22 18:09

thomasfedb