101

Let's say I write a mine.service file. Then I use systemctl enable mine.service.

If I later decide to edit mine.service, do I have to tell systemd that mine.service was changed? If so, how do I do that?

127

After you make changes to your unit file, you should run systemctl daemon-reload, as outlined here.

daemon-reload
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.

You can then restart (or reload) your service as you desire with

systemctl restart your-service-name

(daemon-reload won't reload/restart the services themselves, just makes systemd aware of the new configuration)

  • 2
    I found I also needed to run a systemctl restart to actually restart the service itself... – hwjp Oct 4 '16 at 20:52
  • 2
    Just in case, daemon-reload isn't universal, have got to run systemctl --user daemon-reload for user services. – Olegs Jeremejevs Jan 25 '18 at 22:06
4

As an addition to the answer above: In case you changed something in the [Install] directive, you may need to run sudo systemctl reenable YOURUNITFILE in order to recreate the symlinks in the .target directories.

  • This did the trick for me! Didn't get it why systemctl wasn't reloading the service file. – antonagestam Sep 21 '18 at 15:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.