3 ms·
But you aren't using bash! #!/sbin/openrc-run > openrc-run is basically an interpreter for shell scripts which provides an easy interface to the often com
by ilyt 3y ago
But you aren't using bash!
#!/sbin/openrc-run
> openrc-run is basically an interpreter for shell scripts which provides an easy interface to the often complex system commands and daemons. When a service runs a command it first loads its multiplexed configuration file, then its master configuration file, then /etc/rc.conf and finally the script itself. At this point openrc-run then runs the command given.
It essentially recreated "init script specific DSL" that systemd unit files are!
So you don't have "conceptually simple" SysV script, you have massive wrapper that takes care of the ugly edge cases around starting and managing services and is also is entirely dependent on openrc stuff to work.
And that's not even end of it!
start-stop-daemon --signal QUIT --pidfile $pidfile.oldbin
that's the wrapper Debian and other distros used a lot
So you're using openrc wrapper
to call shell
that calls another wrapper.
To run a service
Systemd equivalent:
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid
TimeoutStopSec=5
KillMode=mixed
I rest my case
- JdeBP 3y agoA unit file that wraps start-stop-daemon, has type=forking, and uses PID files. If it weren't a silly one-off on Hacker News, and if I hadn't already pointed out this foolishness years ago with exactly this service, it would be a prime candidate for the systemd House of Horror. * https://unix.stackexchange.com/a/504374/5132 https://unix.stackexchange.com/a/504374/5132 * https://jdebp.uk/FGA/systemd-house-of-horror/ https://jdebp.uk/FGA/systemd-house-of-horror/ openrc-run is itself merely a shell script, by the way.
- ilyt 3y agoYeah nginx one could just use systemd itself to send sigquit. I'm guessing either author didn't read up on all the options or the option to customize signal in systemd was added later