silver2row Sep 11th, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- ;;; systemd user service example
- ; See also https://pastebin.com/KXVdTNrL for a system service example.
- ; Make sure the directory exists (you only need to do this once):
- ; mkdir -p ~/.config/systemd/user
- ; Save this file as: ~/.config/systemd/user/my-service.service
- ; You can use any name instead of "my-service" of course (but then also adjust that
- ; in the commands below), as long as it doesn't conflict with any existing user
- ; services (see: systemctl --user list-unit-files '*.service').
- ; The file must have a ".service" suffix but you may omit that suffix in the various
- ; commands below, i.e. you can write "my-service" instead of "my-service.service".
- ; You cannot omit the suffix for other types of units (e.g. .timer or .path).
- ; Then, tell systemd to reload its configuration:
- ; systemctl --user daemon-reload
- ; Start your service right now:
- ; systemctl --user start my-service.service
- ; Check on the status of your service:
- ; systemctl --user status my-service.service
- ; If that works, enable your service to start automatically:
- ; systemctl --user enable my-service.service
- ; Make sure the systemd user instance for the "debian" user is started at boot,
- ; otherwise your service(s) will only run when you're logged in:
- ; sudo loginctl enable-linger debian
- ; (you only need to do this once)
- ; Follow log output related to your service (use control-C to exit):
- ; journalctl -f --user-unit=my-service.service
- ; For detailed information about the directives available in the [Unit]
- ; and [Install] sections of systemd units in general, see:
- ; man systemd.unit
- ; For directives available in the [Service] section of service units, see:
- ; man systemd.service
- ; man systemd.exec
- ; man systemd.resource-control
- Description=My user service
- ; When enabled, start service at startup
- ; If your script just does some setup and then exits, use Type=oneshot
- ; To create a service that remains running, use Type=simple
- ; By default the service runs in ~, but you can choose a different working dir:
- ; Program to run (absolute path required):
RAW Paste Data