runsvdir: UNIX init scheme with service supervision from runit
is a nice tool to re-run some service(s) if it dies. It monitor a directory for changes, inotify
like. It execute scripts in directories forever.
I have a structure like this:
$ tree app
app
├── service
│ ├── run
│ └── supervise
├── replay
│ ├── run
│ └── supervise
└── run
├── run
└── supervise
What I would like to do is something like this, based on this in app/run/run
and app/replay/run
(I tried the solution in the link, but it fails):
su - user -c screen -S run<<EOF
[...]
# code
EOF
The code have to block/wait to avoid runsvdir
to run multiple instances in //.
The code is run as root in a docker
container. No systemd
there.
I tested many solutions, have defuncts pids, of multiple processes in // that I want to avoid. I miss something maybe obvious.
Any idea?
- debian 11 until next week ;)
- runit 2.1.2-41
Note/Edit: it's not mandatory to create run/replay from init
. It can be a shell script (bash). The screen
's have to be run only one time.