-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathexample.service
More file actions
35 lines (27 loc) · 1009 Bytes
/
Copy pathexample.service
File metadata and controls
35 lines (27 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# location: /etc/systemd/system/
[Unit]
Description = Example script that runs a shell script at boot
After = syslog.target
[Service]
# make sure the shell script is executable (chmod +x $1)
# and it begins with a shebang (#!/bin/bash)
ExecStart = /path/to/startup.sh
# In my example script I start a node server,
# So tell the serive how to kill it / reload.
ExecStop = kill -INT `cat /run/node.pid`
ExecReload = kill -TERM `cat /run/node.pid`
# In case if it gets stopped, restart it immediately
Restart = always
# With notify Type, service manager will be notified
# when the starting up has finished
Type = notify
# Since Type is notify, notify only service updates
# sent from the main process of the service
NotifyAccess= main
# systemd gets to read the PID of daemon's main process
# see ExecStop and ExecReload
PIDFile = /run/node.pid
[Install]
# multi-user.target corresponds to run level 3
# roughtly meaning wanted by system start
WantedBy = multi-user.target