Post by @mcc@mastodon.social

mcc
@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?

Replying to @mcc@mastodon.social
mcc
@mcc @mastodon.social

$ 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?!?

Replying to @mcc@mastodon.social
Eashwar
@e_nomem @hachyderm.io

@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.

Replying to @e_nomem@hachyderm.io
mcc
@mcc @mastodon.social

@e_nomem Thank you very much. I was looking at a document I would have expected to explain this, but maybe I was skimming.

Replying to @mcc@mastodon.social
Eashwar
@e_nomem @hachyderm.io

@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.