Optionally install systemd service files.
If --with-systemd is given when running the configure script, two systemd service files will be installed. There is a template tinc@.service, which can be used to control individual instances of tinc. For example: systemctl enable tinc@foo Will create an instance for tinc with netname foo. There is also a tinc.service, which can be used to start and stop all instances at once.
This commit is contained in:
parent
5ad43673ac
commit
f54a87b800
5 changed files with 57 additions and 2 deletions
4
systemd/Makefile.am
Normal file
4
systemd/Makefile.am
Normal file
|
@ -0,0 +1,4 @@
|
|||
if WITH_SYSTEMD
|
||||
systemddir = @systemd_path@
|
||||
dist_systemd_DATA = tinc.service tinc@.service
|
||||
endif
|
20
systemd/tinc.service
Normal file
20
systemd/tinc.service
Normal file
|
@ -0,0 +1,20 @@
|
|||
# This is a mostly empty service, but allows commands like stop, start, reload
|
||||
# to propagate to all tinc@ service instances.
|
||||
|
||||
[Unit]
|
||||
Description=Tinc VPN
|
||||
Documentation=info:tinc
|
||||
Documentation=man:tinc(8) man:tinc.conf(5)
|
||||
Documentation=http://tinc-vpn.org/docs/
|
||||
After=network.target
|
||||
Wants=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/bin/true
|
||||
ExecReload=/bin/true
|
||||
WorkingDirectory=/etc/tinc
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
19
systemd/tinc@.service
Normal file
19
systemd/tinc@.service
Normal file
|
@ -0,0 +1,19 @@
|
|||
[Unit]
|
||||
Description=Tinc net %i
|
||||
Documentation=info:tinc
|
||||
Documentation=man:tinc(8) man:tinc.conf(5)
|
||||
Documentation=http://tinc-vpn.org/docs/
|
||||
PartOf=tinc.service
|
||||
ReloadPropagatedFrom=tinc.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/etc/tinc/%i
|
||||
ExecStart=/usr/sbin/tincd -n %i -D
|
||||
ExecReload=/usr/sbin/tinc -n %i reload
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
TimeoutStopSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=tinc.service
|
Loading…
Add table
Add a link
Reference in a new issue