-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't override BLOCK_USER on service reload #335
base: master
Are you sure you want to change the base?
Conversation
If the user has asked for the service to stop, keep it stopped. This keeps it a little more inline with systemd where reloading a config and enable/disable/restarting a service is separate.
Actually on my drive home I had a few more thoughts about this. It might be better if I first explain how we use finit and why I wanted it to behave like this. Most of our services are in a ro filesystem /etc/finit.d, any services that need to be dynamically added/removed are thrown in /var/finit.d (which is symlinked to /etc/finit.d/enabled). This is all working perfectly for us, we can add/remove services as needed then sighup finit to do all the hard work. However when debugging I'd like to disable a service. Unfortunately disabling a service in /var/finit.d causes it to get deleted, and it is not possible to disable a service in /etc/finit.d Perhaps if services had a "disabled" flag that might be more appropriate. Thanks for your time. Let us know what you think. |
First of all, no need to apologize. I really appreciate getting PRs for my projects, in particular when they come with motivation and are split up in logical chunks like you've done! :-) Now, Finit is not systemd and we don't strive to replace or replicate all behaviors of it. But I have to admit, this is one of the cases I've run into myself a few times. However, there are lots of users out there that expect the existing behavior. My former employer, for instance, switches between various system configurations and swaps in/out a lot of services, activating all changes with I didn't fully understand your setup, have you considered using an overlay over I need to give this one a think, and talk to my colleague again, to see what we can do. I'd very much like to support both existing and new use-cases, and breaking changes I try to do only with major version numbers. E.g., file format change is planned for 5.0 and maybe this could be postponed for that too. |
I've now discussed this too with my colleague. He agrees with me, and we will not accept this PR right now. However, he reacted to the following paragraphs (my emphasis added) and suggested two things:
The idea is to tweak your setup slightly, to this:
|
Cheers. I got this working and here is some of my brain vomit:
Thanks for all your time and effort, have a great weekend. |
I've scheduled this PR for v5.0 now. It'll still require some extra logic to go in, i.e., something along the lines of
The By built-in here I guess you mean what's on your read-only filesystem at boot? Finit has it's own built-in services as well, e.g., keventd. Those are real confusing and will be phased out over time (5.0 will be a lot of changes!). But in your case, I'd say that's a you problem ;-)
Good point, never thought about that. Color is one way to go, but maybe some other marker as well since there are color blind people (over represented in our field). I've recently added a lot of JSON output support to initctl, for purposes of scripting (jq is awesome!) and for piping to web interfaces and the likes. The |
This allows for easy access to the *disabled* services: root@anarchy:~# initctl ls --json |jq '.available - .enabled' [ "chronyd.conf", "dnsmasq.conf", "gdbserver.conf", "inadyn.conf", "inetd.conf", "isisd.conf", "lldpd.conf", "mstpd.conf", "ntpd.conf", "ospf6d.conf", "ospfd.conf", "querierd.conf", "ripd.conf", "ripng.conf", "sshd.conf", "syslogd.conf", "telnetd.conf", "uftpd.conf", "wpa_supplicant.conf", "zebra.conf" ] As discussed in PR issue #335 Signed-off-by: Joachim Wiberg <[email protected]>
There, as of c29589c we now have root@anarchy:~# initctl ls --json |jq '.available - .enabled'
[
"chronyd.conf",
"dnsmasq.conf",
"gdbserver.conf",
"inadyn.conf",
"inetd.conf",
"isisd.conf",
"lldpd.conf",
"mstpd.conf",
"ntpd.conf",
"ospf6d.conf",
"ospfd.conf",
"querierd.conf",
"ripd.conf",
"ripng.conf",
"sshd.conf",
"syslogd.conf",
"telnetd.conf",
"uftpd.conf",
"wpa_supplicant.conf",
"zebra.conf"
] |
Looking good! Excited to see where this goes. I'm wondering if parsing Edit: actually I realised this might not make sense. You can have multiple services in a conf file. So really you are enabling/disabling groups of services, and it might not make sense why you can see ServiceA in the list, but you'd have to enable SomethingElse.conf to get it running. |
Yeah, we can't scan By we I mean PID 1, the The |
This might be more a personal choice, but at least how we are using finit if we stop a service manually (only done during debugging) we want it to stay stopped regardless of other things happening in the system.
I think this makes sense and follows systemd where reloading a config doesn't suddenly start the service (or other unrelated services).
Sorry for all the pull request spam, I just wanted to keep all the changes I've done isolated from each other. Feel free to reject any of these.