Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of using a systemd .path unit
# 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
@fiskhest
Copy link

fiskhest commented Sep 12, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment