forked from DDVTECH/mistserver
-
Notifications
You must be signed in to change notification settings - Fork 4
/
mistserver.init
63 lines (57 loc) · 1.05 KB
/
mistserver.init
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
### BEGIN INIT INFO
# Provides: mistserver
# Required-Start: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: MistServer service
# Description: MistServer - next generation multimedia server
### END INIT INFO
NAME=MistController
DESC="MistServer"
CFG_FILE=/etc/mistserver.conf
LOG_FILE=/var/log/mistserver.log
#
# Function that starts the daemon/service
#
do_start()
{
echo "Starting $DESC" "$NAME"
MistController -L $LOG_FILE -c $CFG_FILE &
RETVAL=$?
[ $RETVAL = 0 ] && echo "Success" || echo "Failure"
return $RETVAL
}
#
# Function that stops the daemon/service
#
do_stop()
{
echo "Stopping $DESC" "$NAME"
kill `pidof MistController` >/dev/null 2>&1
RETVAL=$?
[ $RETVAL = 0 ] && echo "Success" || echo "Failure"
return $RETVAL
}
do_restart()
{
do_stop
sleep 10
do_start
return $RETVAL
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart)
do_restart
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
exit 3
;;
esac