Use systemd state RELOADING when ip address changed

In systemd when entering state STOPPING, you can't go back to READY.

So, we check if we're supposed to stop or just restart, and tells that
to systemd.
This commit is contained in:
Anton Lundin 2023-01-25 15:18:16 +01:00
parent a28a6e148f
commit 997fb31d0e

View File

@ -216,8 +216,13 @@ int main(int argc, char* argv[]) {
std::this_thread::sleep_for(std::chrono::seconds(1));
}
#ifdef _USE_SYSTEMD_
sd_notify(0, "STOPPING=1");
sd_notify(0, "STATUS=Stopping");
if (is_terminated()) {
sd_notify(0, "STOPPING=1");
sd_notify(0, "STATUS=Stopping");
} else {
sd_notify(0, "RELOADING=1");
sd_notify(0, "STATUS=Restarting");
}
#endif
/* save session status to file */