How to run a upstart init script using dumb-init?
kanapuli opened this issue · 5 comments
I have an upstart init script called goservice.conf and it's contents are as follows,
description "test.conf"
start on runlevel [2345]
stop on shutdown
respawn
respawn limit 5 2
script
if [-n "/usr/share/main"]; then
mkdir -p /usr/share/main
fi
exec su --session-command="cd ~/ansible/ ; ./main " root
end script
How to run this file using dumb-init so that , if a child process stops ,it is spawned again?
Also does dumb-init provides feature to start and stop child processes like upstart , for example: start <service -name> or stop
Please refer to my reply in #156. dumb-init is dumb in that it does not manage services. Only process reaping for abandoned child processes.
Can't we have it as a feature to manage the child services ? In that case it solves many problems
We'd have to rename the project to smart-init
. This feature is intentionally not implemented. If you want a supervisor there are plenty that solve that use case. They can also be invoked by dumb-init
!
@kanapuliAthavan there are bolt-on container friendly "service managers" which can be used. An example is runit
. Here's an example of running a multi-service container with runit.
ENTRYPOINT ['/dumb-init', '--']
CMD ['/usr/bin/runsvdir', '-P', '/etc/service']
Where /etc/service
directory contains multiple services like:
It's probably obvious but... the above is an example using dumb-init
and runit
to start three services inside of a container: cron
, sshd
, and syslog-ng
.
Note: I've personally moved away from this kind of multi-service container and now use multiple containers with docker-compose and collecting logs from docker the way it's meant to be in docker. In general, I do not recommend this but am giving you this solution since you seem adament to want this.
I also do not want dumb-init to become smart-init. The only reason I use dumb-init instead of tini is because of its dead simplicity.
@samrocketman Thanks for the detailed explanation. I think , we can close this issue thread now