silver2row Sep 11th, 2019 118 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- ;;; systemd system service example
- ; See also https://pastebin.com/uqY2DcGs for a user service example.
- ; Save as this file: /etc/systemd/system/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 system
- ; services (see: systemctl 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:
- ; sudo systemctl daemon-reload
- ; Start your service right now:
- ; sudo systemctl start my-service.service
- ; If that works, enable your service to start at boot:
- ; sudo systemctl enable my-service.service
- ; Follow log output related to your service (use control-C to exit):
- ; journalctl --follow --unit=my-service.service
- ; which you can also abbreviate to:
- ; journalctl -f -u my-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 system service
- ; It may be necessary to include dependencies to prevent the script from
- ; running too early during boot.
- ; For example, if you need networking, you probably want:
- ; If you need stuff in /dev, you probably want:
- ; When enabled, start service at boot
- ; 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 as root, but you can choose a different user:
- ; By default the service runs in /, but you can choose a different working dir:
- ; Program to run (absolute path required):
RAW Paste Data