2

I'm using runit for process supervision. I have the following simple run script for a service:

#!/bin/sh -e
cd /opt/myapp
exec 2>&1
exec chpst -u ubuntu /home/ubuntu/.rvm/bin/myapp_foreman start -t 1 -c web=1,worker=1

This starts foreman wrapped with the appropriate RVM environment using an RVM wrapper. Everything starts and runs fine, but when I issue sv down myapp I can see in the logs that foreman reports receiving SIGTERM and the foreman process terminates, but the child web and worker processes continue running.

This problem also happens if I just manually send a SIGTERM to foreman using kill rather than through runit, so may not be runit specific. However if I run foreman interactively and then do C-c to send SIGINT that works correctly. Sending SIGINT and SIGKILL via kill, though, do not work.

Is there a way I can get foreman to terminate its child processes when run non-interactively like I have here in my runit script?

Gordon Seidoh Worley
  • 7,839
  • 6
  • 45
  • 82

0 Answers0