linux - Upstart tracking wrong PID of Bluepill -


i have bluepill setup monitor delayed_job processes.

using ubuntu 12.04.

i starting , monitoring bluepill service using ubuntu's upstart. upstart config below (/etc/init/bluepill.conf).

description "start bluepill service"  start on runlevel [2] stop on runlevel [016]  expect fork exec sudo /home/deploy/.rvm/wrappers/<app_name>/bluepill load /home/deploy/websites/<app_name>/current/config/server/staging/delayed_job.bluepill  # restart process if dies signal # or exit code not given 'normal exit' stanza. respawn 

i have tried expect daemon instead of expect fork. have tried removing expect... line completely.

when machine boots, bluepill starts fine.

$ ps aux | grep blue root      1154  0.6  0.8 206416 17372 ?        sl   21:19   0:00 bluepilld: <app_name> 

the pid of bluepill process 1154 here. upstart seems tracking wrong pid.

$ initctl status bluepill bluepill start/running, process 990 

this preventing bluepill process getting respawned if forcefully kill bluepill using kill -9.

moreover, think because of wrong pid being tracked, reboot / shutdown hangs , have hard reset machine every time.

what issue here?

clearly, upstart tracks wrong pid. looking @ bluepill source code, uses daemons gem daemonize, in turn forks twice. expect daemon in upstart config should track correct pid -- you've tried that.

if possible you, should run bluepill in foreground, , not use expect stanza @ in upstart config.

from bluepill documentation:

bluepill.application("app_name", :foreground => true) |app|   # ... end 

will run bluepill in foreground.


Comments