blob: cc605268a8126c09552a890362b9f67b0c35c8a9 (
plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/bin/sh
DAEMON=pingtunnel-ng
DAEMON_BIN=ptunnel-ng
PID_FILE=/var/run/$DAEMON.pid
. /etc/init.d/modlibrc
start() {
mkdir -p /tmp/$DAEMON_BIN
[ -z "$PINGTUNNELNG_EXTRA" ] && PINGTUNNELNG_EXTRA="--syslog"
modlib_startdaemon $DAEMON_BIN \
$PINGTUNNELNG_EXTRA \
--magic $PINGTUNNELNG_MAGIC \
--passwd $PINGTUNNELNG_PASSWORD \
--daemon $PID_FILE \
--chroot /tmp/$DAEMON_BIN \
--user nobody \
--group nobody
}
stop_post() {
[ "$1" == "0" ] && rm -rf /tmp/$DAEMON_BIN 2>/dev/null
}
case $1 in
""|load)
modlib_add_user_and_group nobody
modreg cgi 'pingtunnel-ng' 'pingtunnel-ng'
modreg daemon $DAEMON
modlib_start $PINGTUNNELNG_ENABLED
;;
unload)
modunreg daemon $DAEMON
modunreg cgi 'pingtunnel-ng'
modlib_stop
;;
start)
modlib_start
;;
stop)
modlib_stop
;;
restart)
modlib_restart
;;
status)
modlib_status
;;
*)
echo "Usage: $0 [load|unload|start|stop|restart|status]" 1>&2
exit 1
;;
esac
exit 0
|