Last active
September 12, 2019 13:44
-
-
Save SunSparc/12c82d1752dd57b912131268f3139017 to your computer and use it in GitHub Desktop.
Example of using a systemd .path unit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Notice the `[Install]` section in the `.path` file instead of the `.service` file. | |
# This is important for packaging. | |
------------------------------------------------ | |
/lib/systemd/system/package-name.path | |
------------------------------------------------ | |
[Path] | |
PathChanged=/etc/package-name.config | |
[Install] | |
WantedBy=default.target | |
------------------------------------------------ | |
/lib/systemd/system/package-name.service | |
------------------------------------------------ | |
[Unit] | |
Description=package-name | |
After=network-online.target | |
Requires=network-online.target | |
[Service] | |
Type=simple | |
ExecStart=/opt/package-name/package-name -config=/etc/package-name.config | |
------------------------------------------------ | |
# Note: For debian packaging, as of March 2017, the path unit is not natively | |
# supported, as the service unit is. An interim solution is specified here: | |
# http://askubuntu.com/questions/885439/what-is-the-proper-way-to-package-path-unit-files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Never got it to work with these instructions, if someone manages to get here through a search engine, I recommend https://blog.andrewkeech.com/posts/170809_path.html