]> git.pld-linux.org Git - packages/mythtv.git/blame - mythbackend.init
- updated python BRs
[packages/mythtv.git] / mythbackend.init
CommitLineData
02f42b3d 1#!/bin/sh
89940d82 2#
02f42b3d 3# mythbackend Server component of MythTV
89940d82 4#
02f42b3d 5# chkconfig: 2345 86 14
3c5a5851
ER
6# description: Starts the mythbackend process as a daemon after the XWindows \
7# system is started, in runlevel 5. This allows scheduled \
8# recordings to occur without manual intervention.
89940d82 9# processname: mythbackend
3c5a5851 10# pidfile: /var/run/mythtv/mythbackend.pid
89940d82
ER
11# config: /etc/sysconfig/mythbackend
12
13# Source function library.
14. /etc/rc.d/init.d/functions
15
92f04347
ER
16MYTHTV_USER=mythtv
17OPTIONS=
18
89940d82
ER
19if [ -f /etc/sysconfig/mythbackend ]; then
20 . /etc/sysconfig/mythbackend
21fi
22
f2206327 23pidfile=/var/run/mythtv/mythbackend.pid
89940d82 24
04283632 25start() {
89940d82 26 # Start daemons.
93ffc3a9 27 if [ -f /var/lock/subsys/mythbackend ]; then
89940d82 28 msg_already_running "Mythbackend"
93ffc3a9 29 return
89940d82 30 fi
93ffc3a9
ER
31
32 msg_starting "Mythbackend"
33 daemon /usr/sbin/mythbackend --daemon \
92f04347 34 --user $MYTHTV_USER \
93ffc3a9
ER
35 --logfile /var/log/mythtv/mythbackend.log \
36 --pidfile $pidfile \
37 $OPTIONS
38 RETVAL=$?
39 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mythbackend
04283632
ER
40}
41
42stop() {
89940d82 43 # Stop daemons.
93ffc3a9 44 if [ ! -f /var/lock/subsys/mythbackend ]; then
89940d82 45 msg_not_running "Mythbackend"
93ffc3a9
ER
46 return
47 fi
48
49 msg_stopping "Mythbackend"
50 killproc --pidfile mythtv/mythbackend.pid mythbackend
51 rm -f /var/lock/subsys/mythbackend $pidfile >/dev/null 2>&1
52}
53
1b6822bd
ER
54condrestart() {
55 if [ ! -f /var/lock/subsys/mythbackend ]; then
56 msg_not_running "Mythbackend"
57 RETVAL=$1
58 return
59 fi
60
61 stop
62 start
63}
64
93ffc3a9
ER
65flush-logs() {
66 if [ ! -f /var/lock/subsys/mythbackend ]; then
67 return
89940d82 68 fi
93ffc3a9
ER
69
70 show "Rotating %s logs" "Mythbackend"
71 killproc --pidfile $pidfile mythbackend -HUP
04283632
ER
72}
73
74RETVAL=0
75# See how we were called.
76case "$1" in
93ffc3a9 77 start)
04283632
ER
78 start
79 ;;
93ffc3a9 80 stop)
04283632
ER
81 stop
82 ;;
93ffc3a9 83 restart)
04283632
ER
84 stop
85 start
86 ;;
1b6822bd
ER
87 try-restart)
88 condrestart 0
89 ;;
90 force-reload)
91 condrestart 7
92 ;;
93ffc3a9
ER
93 flush-logs)
94 flush-logs
95 ;;
96 status)
97 status --pidfile $pidfile mythbackend
02f42b3d 98 ;;
93ffc3a9 99 *)
1b6822bd 100 msg_usage "$0 {start|stop|restart|try-restart|force-reload|flush-logs|status}"
89940d82
ER
101 exit 3
102esac
103
104exit $RETVAL
This page took 1.565457 seconds and 4 git commands to generate.