Skip to content

Instantly share code, notes, and snippets.

@T99
Last active August 7, 2021 19:09
Show Gist options
  • Save T99/85479fe21de576c19015500ab375bac6 to your computer and use it in GitHub Desktop.
Save T99/85479fe21de576c19015500ab375bac6 to your computer and use it in GitHub Desktop.
Systemd Service File Template
# Check the following link for more info:
# https://www.freedesktop.org/software/systemd/man/systemd.service.html
[Unit]
# The descriptive text used to describe this service.
Description=description for this service
# The directory inside which this service should run.
WorkingDirectory=/home/web/web_trevorsears/@
# A list of units that must start before this service can start.
After=network.target
[Service]
# The type of service, usually either 'oneshot' or 'simple'.
Type=simple
# The command that should be run when starting this service.
ExecStart=/path/to/executable arg1 arg2
# This command will be run to stop this service.
ExecStop=/path/to/executable arg1 arg2
# This command will be run to restart/reload this service.
ExecReload=/path/to/executable arg1 arg2
# If set, this will cause this service to attempt to restart itself when the
# pertinent event occurs.
Restart=
# The user that should run this service when started.
User=user
# The group that should run this service when started.
Group=group
# The path to a file that should be used to store this service's primary PID.
PIDFile=/path/to/pidfile.pid
[Install]
# A list of units that, when started, will attempt to start this service.
WantedBy=multi-user.target
# A list of units that, when started, will require this service to start in
# order for their own service to successfully start.
RequiredBy=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment