I have a service that stopped suddenly. I tried to restart that service but failed and was asked to run:
What does it exactly do? What is a
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
man systemctl says:
Reload 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.
This command should not be confused with the reload command.
So, it's a "soft" reload, essentially; taking changed configurations from filesystem and regenerating dependency trees.
Generators are small binaries that live in /usr/lib/systemd/user-generators/ and other directories listed above. systemd(1) will execute those binaries very early at bootup and at configuration reload time — before unit files are loaded. Generators can dynamically generate unit files or create symbolic links to unit files to add additional dependencies, thus extending or overriding existing definitions. Their main purpose is to convert configuration files that are not native unit files dynamically into native unit files.
Generators are loaded from a set of paths determined during compilation, listed above. System and user generators are loaded from directories with names ending in system-generators/ and user-generators/, respectively. Generators found in directories listed earlier override the ones with the same name in directories lower in the list. A symlink to /dev/null or an empty file can be used to mask a generator, thereby preventing it from running. Please note that the order of the two directories with the highest priority is reversed with respect to the unit load path and generators in /run overwrite those in /etc.
After installing new generators or updating the configuration, systemctl daemon-reload may be executed. This will delete the previous configuration created by generators, re-run all generators, and cause systemd to reload units from disk. See systemctl(1) for more information.
On logoff or just prior to a reboot, I would use a simple test of the /etc/fstab. I would just check its timestamp from a previously saved value. You could also remember a previously calculated sha1 sum.
A script to include as mentioned, will go a long way to not forgetting to run the daemon reload.
If you change
/lib/systemd/system/<servicename>.service and restart via
systemctl restart <servicename>.service
it will not load the new settings unless you do a
systemctl daemon-reload. Instead, it will just restart the old cached settings with no changes.
This has burned us many times. People just restart service but forget that it does not reload the changes.