You are not logged in.

#1 2024-01-12 16:00:16

phoenix324
Member
Registered: 2023-08-23
Posts: 42

[solved] Is `systemctl reload <unit-name>` related to `ExecReload`?

systemctl man Page->

       daemon-reload
Reload the systemd manager configuration. This will rerun all generators (see systemd.generator(7)), reload all unit files, and recreate the entire dependency tree. While the daemon is being reloaded, all sockets systemd listens on behalf of user configuration will stay accessible.


       reload PATTERN...
           Asks all units listed on the command line to reload their configuration. Note that this will reload the service-specific configuration, not the unit configuration file of systemd. If you want systemd to reload the configuration file of a unit, use the daemon-reload command. In other words: for the example case of Apache, this will reload Apache's httpd.conf in the web server, not the apache.service systemd unit file.
           This command should not be confused with the daemon-reload command.

ExecReload ->  Specifies commands or scripts to be executed when the unit is reloaded.

  Source



I tried a little experiment where i added `ExecReload=killall wlsunset` and when used `systemctl reload <unit-name>` it executed `killall wlsunset`.

My doubt -> Then is this answer wrong here What is the difference betweem daemon-reload and reload? , it talks about SIGHUP being sent to program when using `systemctl reload` command.

Last edited by phoenix324 (2024-01-12 18:09:55)

Offline

#2 2024-01-12 17:25:12

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,809

Re: [solved] Is `systemctl reload <unit-name>` related to `ExecReload`?

Of course it is, systemd works via service files, and will trigger things in relation to service files.

And for the case outlined in the stackoverflow thread, the httpd service contains

ExecReload=/usr/bin/httpd -k graceful

which is what will get executed.

Offline

#3 2024-01-12 18:09:08

phoenix324
Member
Registered: 2023-08-23
Posts: 42

Re: [solved] Is `systemctl reload <unit-name>` related to `ExecReload`?

V1del wrote:

Of course it is, systemd works via service files, and will trigger things in relation to service files.

And for the case outlined in the stackoverflow thread, the httpd service contains

ExecReload=/usr/bin/httpd -k graceful

which is what will get executed.

This is what was bugging me, every article/post dosent' mention `ExecReload` would be run on `systemctl reload`. Even man page is confusing.

Thank you.

Last edited by phoenix324 (2024-01-12 18:09:39)

Offline

Board footer

Powered by FluxBB