Skip to content

Instantly share code, notes, and snippets.

@SunSparc
Last active September 12, 2019 13:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SunSparc/12c82d1752dd57b912131268f3139017 to your computer and use it in GitHub Desktop.
Save SunSparc/12c82d1752dd57b912131268f3139017 to your computer and use it in GitHub Desktop.
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

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