Post by @mcc@mastodon.social
Okay so.
I'm apparently not allowed to use apache2ctl anymore. It confuses systemd.
apache2ctl had a command named "graceful". This would, instead of hard rebooting the server, attempt to cleanly exit the server when all files currently being served were done being served, then restart it.
Can systemd restart be configured to do this? Will systemd restart somehow do this by default?
$ sudo systemctl reload apache2
apache2.service is not active, cannot reload
LENNART, I THINK YOU'LL FIND THAT'S IN FACT THE EASIEST TIME TO RELOAD?!?
@mcc@mastodon.social doesn't reload keep apache2 running anyway tho? like if you wanted it to exit gracefully well...
@mcc@mastodon.social nvm i missed the part about it restarting it after. ig systemd reload would be your best bet then
Okay so get this. I looked inside the apache2.service file.
ExecStart=/usr/sbin/apachectl start
ExecStop=/usr/sbin/apachectl graceful-stop
ExecReload=/usr/sbin/apachectl graceful
So switching to systemd doesn't take away the apachectl behaviors I want at all! Because I haven't stopped using apachectl at all!! All that's changed is I no longer get to call apachectl myself!! Lennart has to do it for me!!!
@mcc yes. on NetBSD we've been noticing more and more ways in which systemd's abstractions had been getting in our way, and we'd been taking it as a good thing (reproducibility!), but, uh............
@mcc `systemctl try-reload-or-restart <name>.service` will reload the service, if it supports reload, or else restart it, but only if it's already active.
`systemctl reload-or-restart` (without the `try-` prefix) is the same, but will activate the service if it is inactive as well.
@e_nomem Thank you very much. I was looking at a document I would have expected to explain this, but maybe I was skimming.
@mcc Honestly, I only discovered that these commands existed by reading the manpage of systemctl. I've never seen them referenced anywhere else.
I pretty much exclusively use `systemctl try-reload-or-restart` in shell scripts as the safe default to restart a service.
@mcc I need to learn his middle name so I can yell his full government name like a pissed off mom. LENNART ALBERT POETTERING, WE DO NOT HINGE EVERYTHING ON SOCKET ACTIVATION IN THIS HOUSE. you see the vision. that's probably not his real name, except maybe by coincidence. but it would be like that.
@linear (what i wanted is "get the system running with the new configuration, with the minimum disruption to service")
