-
Notifications
You must be signed in to change notification settings - Fork 0
/
coapServer
executable file
·62 lines (54 loc) · 1.61 KB
/
coapServer
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
#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: coapServer
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Python3 CoAP Server
# Description: For more instruction about this service, please check :
# https://github.com/gzsierra/pycoap
### END INIT INFO
# Author: Nicolas Nadeau <[email protected]>
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.
DESC="Python3 CoAP Service"
DAEMON=/usr/bin/coapServer
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NAME=coapServer
DAEMONARGS=""
PIDFILE=/var/run/$NAME.pid
LOGFILE=/var/log/$NAME.log
. /lib/lsb/init-functions
test -f $DAEMON || exit 0
case "$1" in
start)
start-stop-daemon --start --background \
--pidfile $PIDFILE --make-pidfile --startas /bin/bash \
-- -c "exec stdbuf -oL -eL $DAEMON $DAEMONARGS > $LOGFILE 2>&1"
log_end_msg $?
;;
stop)
start-stop-daemon --stop --pidfile $PIDFILE
log_end_msg $?
rm -f $PIDFILE
;;
restart)
$0 stop
$0 start
;;
status)
start-stop-daemon --status --pidfile $PIDFILE
log_end_msg $?
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 2
;;
esac
exit 0