runit calls script instead of service command

289 Views Asked by At

Is is possible that runit calls script instead of calling directly the service. For example, I have an init script to launch uwsgi. Could i just call this script inside runit init script? Thank you in advance.

2

There are 2 best solutions below

0
unconditional On

A "service" run by runit is actually a script, which is named run and usually located in a dir like /etc/sv/your_service/ along with some other files. So yes, you can call your script from that, but I suppose it'd be better to modify your init script so that runit runs it as a "service".

0
Tino On

Init scripts expect the service they start to daemonize. Runit expects a service not to daemonize, but to run in the foreground to supervise and to connect to the controlling terminal. This is why an initscript is not suited to be invoked by a runit service.

Furthermore, the daemon has to be run with exec, otherwise runit wouldn't be able to connect to the controlling terminal. This is also missing in an init script.