Hacker News new | past | comments | ask | show | jobs | submit
This is the whole service management for OpenBSD

https://github.com/openbsd/src/blob/master/usr.sbin/rcctl/rc...

Then you got the initialization script

https://github.com/openbsd/src/blob/master/etc/rc

Service file can be very small

https://github.com/openbsd/src/blob/master/etc/rc.d/httpd

Powered by

https://github.com/openbsd/src/blob/master/etc/rc.d/rc.subr

Also daemon(3) for running as a system service

https://man.openbsd.org/daemon.3

And no need to track pid. It uses pgrep with the flags and the program name by default. I believe OpenRC does the same.

https://github.com/openbsd/src/blob/f5d74fd467fccdfc60b450a7...

Yep, that's exactly the mess I'm talking about. Scripts that are ALWAYS incorrect, incomplete, and unreliable.

For example, can it kill a runaway Apache process tree? Or safely confine the CGI scripts so that they don't cause the OOM killer to terminate the sshd?

And what happens if the "stop" command hangs indefinitely?

> And no need to track pid. It uses pgrep with the flags and the program name by default. I believe OpenRC does the same.

Facepalm.

loading story #50475131