Ironically the very small percentage of users that use Linux on the desktop tend to be of the more die-hard variety that don't welcome systemd's view of the world.
In the end systemd is an extremely bad steward of Linux.
Ironically the very small percentage of users that use Linux on the desktop tend to be of the more die-hard variety that don't welcome systemd's view of the world.
In the end systemd is an extremely bad steward of Linux.
http://cvsweb.netbsd.org/bsdweb.cgi/src/etc/rc.d/cron?rev=1....
this does not require systemd cruft and all of it's over-opinionated facebook-youth narcissistic my-use-case is all that matters tentacles.
(In particular, will the error be logged if the program fails to start due to bad config file? And how do I describe “only start once “volume X” is mounted?j)
sure, but this is a 'reasonable shell library' rather than the 'systemd cruft + tentacles' that I mention.
want it to do something else?
write your own functions.
want "an init system that can automatically restart failed services, and with decent dependency management"
here you go:
# cat /etc/daemoncheck
#! /bin/sh
docheck() {
initscript="/etc/rc.d/$1";
if [ -x "$initscript" ]; then
$initscript check > /dev/null \
|| $initscript start
fi
}
docheck ntpd
docheck inetd
docheck dhcpd
docheck tftpd
& throw that, or similar in cron or make it run in a while loop. Nothing precludes
some rudimentary shell script being bundled as part of a simple shell-style init system
out of the box.I don't need 5000 lines of C code, multiple binaries, 10 layers of symlinks, and all of the rest of it. a few hundred lines of shell that anyone who knows shell and how to read manual pages (that are kept up to date on the actual system, not bad HTML needing 10 tools to render the last time someone thought to update the documentation) can understand the entierty of in literally one sitting.
I do remember using the gentoo's rc system, and writing the script very much like you wrote here, and it always "kinda works". Specifically, how is "$initscript check" will work? I have seen three approaches:
- Sometimes, "check" searches for the process with the given name. That can fail if you are on multi-user system, and a user runs a server on non-standard port.
- Sometimes, "check" checks for .pid file, and that process with given pid exists. This can fail if you have high process churn, and your PID got reused.
- Sometimes, "check" does completely strange things. Like check that PID file exists, but not the contents -- so it would work fine if you use start/stop commands, but will not notice if the server crashes.
So yes, you can do it in shell, and it will work.. most of the time. And hey, you can always fix it -- the first time you discover that your server did not restart, you'd edit the script and add port checking... and then upgrade it to better kill runaway processes.. you can keep going and going.
In the end, I think it all brings you back to old pets vs cattle debate. If your server is manually provisioned, each process is carefully tuned, then shell scripts are for you.
If you just want to say "install something_d" and have things work, across thousands of systems, at the expense of uglier config and non-optimal file layout -- then more advanced inits are way better.
https://netbsd.gw.com/cgi-bin/man-cgi?rc+8+NetBSD-current https://netbsd.gw.com/cgi-bin/man-cgi?rc.subr+8+NetBSD-curre...
and dependency ordering here:
https://netbsd.gw.com/cgi-bin/man-cgi?rcorder+8+NetBSD-curre...
design rationale & further discussion here:
Luke Mewburn, "The Design and Implementation of the NetBSD rc.d system",
Proceedings of the FREENIX Track: 2001 USENIX Annual Technical
Conference, USENIX Association,
http://www.usenix.org/publications/library/proceedings/usenix01/freenix01/full_papers/mewburn/mewburn.pdf,
June 25-30, 2001.Next, I wanted to check if "run_rc_command" suppressed the stdout/stderr of the program it was running. And here is where I hit a first difficulty:
- The rc.subr manpage you referred to does not seem to mention logging it in any way.
- So I looked in the source.. and it is 1300 line shell script [1], with run_rc_command being pretty complex function, with thousands of lines of code.
I found answer to my question (apparently it does not care about stdout/stderr at all), but this was non-trivial.
Compare it to systemd, which just have this information in the official manpages [2].
Are you still claiming shell-based init scripts are simpler?
(Expert level question: you have a third-party Java app, which provides a single sh file for you to run. Can you use it with your "10 line init script"? Why not?)
[1] https://github.com/IIJ-NetBSD/netbsd-src/blob/e4505e0610ceb1...
[2] https://www.freedesktop.org/software/systemd/man/systemd.exe...
Don't hate new stuff, it's OK to have same changes and sorry to say, the old home directory is awful. Maybe the new will bring something good as well (don't know yet, but I try to stay open minded). For example I would love to see roaming home profiles in Linux, not only for the desktop but for servers as well.
No, most features of systemd are focused in Servers (systemd-resolved itself is one example, it can be used by Desktops, however the reason for its creation was containers that needed to have faster DNS resolution).
Actually, systemd-homed is the first systemd feature that I know that the reason to exist is for Laptop users (and Desktop users somewhat less). Most new features of systemd are created for either servers or embedded users. For example:
- Portable services (user case: servers): http://0pointer.net/blog/walkthrough-for-portable-services.h...
- IP Accounting (user case: servers): http://0pointer.net/blog/category/projects.html
- Dynamic users (user case: servers): http://0pointer.net/blog/dynamic-users-with-systemd.html
- SD-event (user case: all): http://0pointer.net/blog/introducing-sd-event.html
- SD-bus (user case: all): http://0pointer.net/blog/the-new-sd-bus-api-of-systemd.html
- Stateless systems (user case: embedded): http://0pointer.net/blog/revisiting-how-we-put-together-linu...
For all of those features, only SD-bus is more relevant to Desktop user case since it is where DBus is more common. However Dbus is also used in server/embedded user cases sometimes. The rest of features may be interesting for Desktop however they mostly are used for either servers or embedded systems.
> it will be forced upon server setups
I am really curious of which systemd features are being forced in any distro. systemd-resolved for example is not used by default in any distro that I know (Debian, Ubuntu, Arch, NixOS).
It’s not just that they added their own caching resolver - it’s that it then ignores the decades old standard resolv.conf and hijacks system name resolution by default.
That finally prompted me to remove systemd from the one machine I had it on.