Ubuntu Pastebin

Paste from mikea at Thu, 14 Jan 2016 21:01:05 +0000

Download as text
 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/sh
### BEGIN INIT INFO
# Provides:          mythtv-backend
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Should-Start:      mysql
# Should-Stop:       mysql
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# X-Interactive:     true
# Short-Description: Start/Stop the MythTV server.
### END INIT INFO

if [ -f /etc/default/locale ]; then
  . /etc/default/locale
  export LANG
fi

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/mythbackend
NAME="mythbackend"
DESC="MythTV server"

test -x $DAEMON || exit 0

. /lib/lsb/init-functions

set -e

USER=mythtv
RUNDIR=/var/run/mythtv
ARGS="--daemon --syslog local7 --pidfile $RUNDIR/$NAME.pid"
EXTRA_ARGS=""
NICE=0

if [ -f /etc/default/mythtv-backend ]; then
  . /etc/default/mythtv-backend
fi

ARGS="$ARGS $EXTRA_ARGS"

mkdir -p $RUNDIR
chown -R $USER $RUNDIR

unset DISPLAY
unset SESSION_MANAGER

case "$1" in
  start)
	if test -e $RUNDIR/$NAME.pid ; then
		echo "mythbackend already running, use restart instead."
	else
		echo -n "Starting $DESC: $NAME "
		start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \
			--chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS
		echo "."
	fi
	;;
  stop)
	echo -n "Stopping $DESC: $NAME "
	start-stop-daemon --stop --oknodo --pidfile $RUNDIR/$NAME.pid \
		--chuid $USER --exec $DAEMON -- $ARGS
	test -e $RUNDIR/$NAME.pid && rm $RUNDIR/$NAME.pid
	echo "."
	;;
  restart|force-reload)
	echo -n "Restarting $DESC: $NAME "
	start-stop-daemon --stop --oknodo --retry 10 --pidfile $RUNDIR/$NAME.pid \
                --chuid $USER --exec $DAEMON -- $ARGS
	echo "."
	start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \
                --chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS
	echo "."
	;;
  reload)
  	start-stop-daemon --stop --oknodo --signal HUP --pidfile \
  	$RUNDIR/$NAME.pid --chuid $USER --exec $DAEMON -- $ARGS
  	echo "."
  	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
Download as text