cat /etc/service/my_service/run
#!/bin/sh
sv start service_required || exit 1
exec my_service
But if "service_required" is not a daemon?
For example run ssh daemon is required bring a network interface up.
Bring a network interface up is accomplished from a simple/very few command/s such as ifup and friend.
ifup execute and terminate, and execute again forever.
I have found a ugly solution. Declare "sv once not-daemon" in the script.
Or a very ugly solution: while true; do; read VAR; done and a trap on TERM signal that execute final command
(for example ifdown -a at exit).
Browsing around seems distro put it in stage 1. It's the cleanest solution... but how to do if I want intersperse
daemon and not daemon and define for example a cascade of dependencies like this:
service1 (daemon) depends script (not daemon) depends service2 (daemon)?