chiark / gitweb /
doc/.gitignore: Make the patterns more general.
[tripe] / contrib / tripe.service.in
CommitLineData
f48ae55b
MW
1;;; -*-conf-windows-*-
2;;;
3;;; systemd service configuration for the main tripe server.
4
5[Unit]
6Description=Tripe virtual private network server
7Documentation=man:tripe(8)
8
9ConditionPathExists=@sbindir@/tripe
10ConditionPathExists=@bindir@/tripectl
11
12After=syslog.target network.target
13
14[Install]
15WantedBy=multi-user.target
16
17[Service]
18Type=forking
19PIDFile=/var/run/tripectl.pid
20
21ExecStart=/bin/sh -e -c ' \
22 . @initconfig@ && \
23 logopt= && \
24 case $${syslogp-nil} in nil) ;; *) logopt="$$logopt -l" ;; esac && \
25 case $${logfile+t},$${syslogp-nil} in \
26 t,*) logopt="$$logopt -f$$logfile" ;; \
27 ,nil) logopt="$$logopt -f@logfile@" ;; \
28 esac && \
29 exec @bindir@/tripectl -D -s -p@sbindir@/tripe \
30 -P/var/run/tripectl.pid \
31 $$logopt \
32 $${keytag+-S-t$$keytag} \
33 $${addr+-S-b$$addr} $${port+-S-p$$port} \
34 $${user+-U$$user} $${group+-G$$group} \
35 $${sockmode+-S-m$$sockmode} \
36 $${trace+-S-t$$trace} \
37 $${tunnel+-S-n$$tunnel} \
38 $$miscopts'
39
40ExecReload=@bindir@/tripectl RELOAD
41ExecStop=@bindir@/tripectl QUIT
42
43ExecStartPre=/bin/sh -e -c ' \
44 if { test -f /proc/misc && grep -q tun /proc/misc; } || \
45 modprobe -q tun; \
46 then \
47 : good; \
48 else \
49 echo >&2 "tripe needs the TUN/TAP driver"; exit 1; \
50 fi; \
51 if test -c /dev/net/tun; then \
52 : good; \
53 else \
54 echo >&2 "tripe needs /dev/net/tun, which is missing"; \
55 exit 1; \
56 fi'
57
58ExecStartPost=/bin/sh -e -c ' \
59 for i in 1 2 3 4 give-up; do \
60 @bindir@/tripectl HELP >/dev/null 2>&1 && break; \
61 sleep 1; \
62 done; \
63 case $$i in \
64 give-up) echo >&2 "tripe daemon failed to start"; exit 1 ;; \
65 esac'