-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsntd
87 lines (68 loc) · 2.3 KB
/
sntd
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
#
# SNT -- Simple-Network-Tool
#
# chkconfig 2345 90 60
# description: This is a service for running snt server.
#
name="snt"
command="/usr/bin/snt"
command_args=" --server --verbose --cipher=all --delta=all --compression=all --transport=all --secure --listen=128 "
daemon="/usr/bin/daemon"
# Check if daemon and snt program is installed.
[ -x "$daemon" ] && [ -x "$command" ] || exit 0
daemon_start_args=""
pidfiles="/var/run"
user=""
chroot=""
chdir=""
umask=""
stdout="daemon.info"
stderr="daemon.err"
# Unix shell script argument switch case.
case "$1" in
start)
if "$daemon" --running --name "$name" --pidfiles "$pidfiles"
then
echo "$name is already running."
else
echo -n "Starting $name...\n"
"$daemon" --respawn $daemon_start_args \
--name "$name" --pidfiles "$pidfiles" \
${user:+--user $user} ${chroot:+--chroot $<E2>chroot}\
${chdir:+--chdir $chdir} ${umask:+--umask $umask} \
${stdout:+--stdout $stdout} ${stderr:+--stderr $stderr} \
-- \
"$command" $command_args
echo done
fi
;;
stop)
if "$daemon" --running --name "$name" --pidfiles "$pidfiles"
then
echo -n "Stopping $name...\n"
"$daemon" --stop --name "$name" --pidfiles "$pidfiles"
echo "done"
else
echo "$name is not running."
fi
;;
restart|reload)
if "$daemon" --running --name "$name" --pidfiles "$pidfiles"
then
echo -n "Restarting $name...\n"
"$daemon" --restart --name "$name" --pidfiles "$pidfiles"
else
echo "$name is not runnning."
exit 1
fi
;;
status)
"$daemon" --running --name "$name" --pidfiles "$pidfiles" --verbose
;;
*)
echo "usage: $0 <start|stop|restart|reload|status>" >&2
exit 1
;;
esac
exit 0