summaryrefslogtreecommitdiffstats
path: root/abs/core/runit-scripts/runitscripts/services/mythbackend/run
blob: 903979cf5c9cf536f7847d31a5a8fdbf678c461b (plain)
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
88
89
90
#!/bin/sh
exec 2>&1
. /etc/systemconfig
export TERM=linux
. /etc/rc.conf
. /etc/rc.d/functions

#Run autocard
if [ ! -e /etc/udev/mv-persistent-video.description ]
then
    /usr/MythVantage/bin/autocard.py insertdb >/tmp/autocard.log &
fi

#wait for mysql
if [ -e /service/mysql ]
then
    /sbin/svwaitup -s 10 /service/mysql
fi

if [ -e /service/avahi ]
then
    /sbin/svwaitup -s 2 /service/avahi
fi

#profile is here to setup LC_ALL/locale
MYTH_RUN_STATUS="1"
. /etc/profile

MYTH_ARGS="-q --syslog local6"
[ -f /etc/conf.d/mythbackend ] && . /etc/conf.d/mythbackend


stat_runit "Scanning for new storage"
MYTHCONFDIR=/usr/share/mythtv /usr/LH/bin/add_storage.py --report > /dev/null
if [ -e /tmp/scan_report ]
then
        echo "#####################################################"
        echo "                New storage found                    "
        echo ""
        cat /tmp/scan_report
        echo ""
        echo "  run /usr/LH/bin/add_storage.py to make it available "
        echo "#######################################################"

fi







export HOME=/root
# 	if [ -f /tmp/debug ]
# 		then
# 			echo "using gbd/debug"
# 			gdb /usr/bin/mythbackend -x $MV_ROOT/mbegdbcommands.txt
# 			bash -c "osdClient.pl localhost 5000 'Restart gdb mbe  :::SYS' "&
# 			mv gdb.txt /data/home/mythtv/gdb.txt.mythbackend
# 			chown mythtv:mythtv /data/home/mythtv/gdb.txt.mythbackend
# 			sleep 10
#
#   else
            if [ x"$SystemType" = "xSlave_backend" ]
            then
                #do init check
                MYTHCONFDIR=/usr/share/mythtv /usr/LH/bin/be_check.py
                rc=$?
                while [ $rc -ne 0 ]
                do
                    #msg "Waiting for connection to MythBackend"
                    echo "    * Waiting for connection to primary MythBackend"
                    MYTHCONFDIR=/usr/share/mythtv /usr/LH/bin/be_check.py
                    rc=$?
                    sleep 6
                done
                stat_runit "Starting Slave MythBackend"
            else
                stat_runit "Starting Primary MythBackend"
            fi



            if pacman -Q mythtv | grep -q 0.24
            then
                exec su mythtv -c "/usr/bin/mythbackend --logfile /var/log/mythtv/mythbackend.log"
            else
                exec su mythtv -c "/usr/bin/mythbackend -q --syslog local6"
            fi
# 		fi