diff options
Diffstat (limited to 'abs/core/runit-scripts/runitscripts')
7 files changed, 104 insertions, 70 deletions
diff --git a/abs/core/runit-scripts/runitscripts/services/ddclient/run b/abs/core/runit-scripts/runitscripts/services/ddclient/run new file mode 100755 index 0000000..c5488f6 --- /dev/null +++ b/abs/core/runit-scripts/runitscripts/services/ddclient/run @@ -0,0 +1,8 @@ +#!/bin/sh +export TERM=linux +. /etc/rc.conf +. /etc/rc.d/functions +stat_runit "Starting ddclient" + + +exec /usr/sbin/ddclient -foreground &> /var/log/ddclient.log diff --git a/abs/core/runit-scripts/runitscripts/services/frontend/finish b/abs/core/runit-scripts/runitscripts/services/frontend/finish index 5b0bd5b..417488d 100755 --- a/abs/core/runit-scripts/runitscripts/services/frontend/finish +++ b/abs/core/runit-scripts/runitscripts/services/frontend/finish @@ -1,28 +1,45 @@ -#!/bin/bash -exec 2>&1 -export TERM=linux -. /etc/rc.conf -. /etc/rc.d/functions +#!/bin/bash +exec 2>&1 +export TERM=linux +. /etc/rc.conf +. /etc/rc.d/functions + +function cleanup(){ + rm -f /etc/sv/frontend/.runtime/* + printhl " Cleaning up /etc/sv/frontend/.runtime/" +} grep -q nox /proc/cmdline STATUS=$? if [ $STATUS = 0 ] then + printhl " status = 0" chvt 2 else + pkill -f "X :0" + printhl " status = 1" if [ ! -d /etc/sv/frontend/.runtime ] then - mkdir -p /etc/sv/frontend/.runtime + mkdir -p /etc/sv/frontend/.runtime fi touch /etc/sv/frontend/.runtime/`date +%s` sleep 0.2 ps -U mythtv -ef |grep "/bin/sh /usr/bin/startx"|grep -v grep|awk ' { print $2 } '|xargs kill -9 2> /dev/null cdate=`date` - numfiles=`/usr/bin/file_time_offset.py -s10 -d/etc/sv/frontend/.runtime` - if [ $numfiles -gt 2 ] + numfilestotal=`/usr/bin/file_time_offset.py -s0 -d/etc/sv/frontend/.runtime` + numfilesover10secondsold=`/usr/bin/file_time_offset.py -s10 -d/etc/sv/frontend/.runtime` + numfileslessthan10secondsold=$(($numfilestotal-$numfilesover10secondsold)) + if [ $numfileslessthan10secondsold -gt 2 ] then sv stop frontend - rm -f /etc/sv/frontend/.runtime/* - printhl " Frontend is not able to start, disabling it." + printhl " Frontend disabled, due to many restarts." + printhl " Run \"sv start frontend\" to try again" + cleanup + else + if [ $numfilestotal -gt 10 ] + then + cleanup + fi fi fi + diff --git a/abs/core/runit-scripts/runitscripts/services/lircd/run b/abs/core/runit-scripts/runitscripts/services/lircd/run index 0a398ac..3ff8af3 100755 --- a/abs/core/runit-scripts/runitscripts/services/lircd/run +++ b/abs/core/runit-scripts/runitscripts/services/lircd/run @@ -6,8 +6,6 @@ export TERM=linux . /etc/rc.conf . /etc/rc.d/functions -#since what we do may not be enough -#if your one of those people, this is where you place your stuff LOG=/tmp/lirc.log @@ -16,12 +14,17 @@ then rm -f $LOG fi +#since what we do may not be enough +#if your one of those people, this is where you place your stuff +#This means place your lirc stuff in /etc/runit/lirc.sh. +#Anything in that file will be used and the rest of this file is ignored + if [ -f /etc/runit/lirc.sh ] then #program must not terminate. stat_runit "Starting lirc" - + /etc/runit/lirc.sh else . /etc/systemconfig @@ -55,8 +58,8 @@ else then #/dev/ttyS0 (COM1), port 0x3f8, irq 4 #/dev/ttyS1 (COM2), port 0x2f8, irq 3 - #/dev/ttyS2 (COM3), port 0x3e8, irq 4 - #/dev/ttyS3 (COM4), port 0x2e8, irq 3 + #/dev/ttyS2 (COM3), port 0x3e8, irq 4 + #/dev/ttyS3 (COM4), port 0x2e8, irq 3 case $serial_port in ttyS0) @@ -72,67 +75,74 @@ else FLAGS="io=0x2e8 irq=3" ;; esac - /usr/bin/setserial /dev/serial_port uart none - sleep 0.5 + /usr/bin/setserial /dev/$serial_port uart none + sleep 0.5 /sbin/modprobe lirc_serial $FLAGS - sleep 0.5 + sleep 0.5 fi dvico_detect if [ x$HostBlasterType = xCommandIR -o x$ReceiverType = xCommandIR ] then - CMD="/usr/sbin/lircd -n --driver=commandir" - printhl " Using commandir" + CMD="/usr/sbin/lircd -r -n --driver=commandir" + printhl " Using commandir" $CMD >>$LOG 2>>$LOG -#echo $CMD + #echo $CMD elif [ x$HostBlasterType = xiguanaIR-usb -o x$ReceiverType = xiguanaIR-usb ] then - sv start igdaemon - CMD="/usr/sbin/lircd -n --driver=iguanaIR" - printhl " Using iguanaIR usb" -#echo $CMD + sv start igdaemon + CMD="/usr/sbin/lircd -r -n --driver=iguanaIR" + printhl " Using iguanaIR usb" + #echo $CMD $CMD >>$LOG 2>>$LOG + + elif [ x$ReceiverType = "xSiliconDust_HDHR" ] + then + # if using the SiliconDust_HDHR as an I/R Receiver + printhl " Using SiliconDust on port 5000" + CMD="/usr/sbin/lircd -H udp -d 5000 -n" + exec $CMD >>$LOG 2>>$LOG else LASTCMD="" for i in `seq 1 $num_lirc` do - CMD="/usr/sbin/lircd -d /dev/lirc$i --output=/dev/lircd$i --pidfile=/var/run/lircd$i.pid --listen=876$i" - printhl " Device $i" -#echo $CMD + CMD="/usr/sbin/lircd -r -d /dev/lirc$i --output=/dev/lircd$i --pidfile=/var/run/lircd$i.pid --listen=876$i" + printhl " Device $i" + #echo $CMD $CMD >>$LOG 2>>$LOG LASTCMD="--connect=localhost:876$i $LASTCMD " done - if [ $RunDvico = "true" ] - then - if [ x$Remotetype = "xdvico" ] + if [ $RunDvico = "true" ] + then + if [ x$Remotetype = "xdvico" ] then - LCMD="/usr/sbin/lircd -n -d /dev/usb/dvicoIR --driver=dvico --output /dev/lircd" + LCMD="/usr/sbin/lircd -r -n -d /dev/usb/dvicoIR --driver=dvico --output /dev/lircd" else - LCMD="/usr/sbin/lircd -n -d /dev/input/irremote --driver=devinput --output /dev/lircd" + LCMD="/usr/sbin/lircd -r -n -d /dev/input/irremote --driver=devinput --output /dev/lircd" fi - if [ $num_lirc -lt 0 ] - then - # Only run Dvico - printhl " Device $Remotetype" -#echo $LCMD - exec $LCMD >>$LOG 2>>$LOG - elif [ $num_lirc -gt -1 ] - then + if [ $num_lirc -lt 0 ] + then + # Only run Dvico + printhl " Device $Remotetype" + #echo $LCMD + exec $LCMD >>$LOG 2>>$LOG + elif [ $num_lirc -gt -1 ] + then i=$((i+1)) CMD="$LCMD --output=/dev/lircd$i --pidfile=/var/run/lircd$i.pid --listen=876$i" $CMD >> $LOG LASTCMD="--connect=localhost:876$i $LASTCMD " - printhl " Device Dvico" - /usr/sbin/lircd -n -d /dev/lirc0 --output /dev/lircd $LASTCMD >>$LOG 2>>$LOG - fi - else - LCMD="/usr/sbin/lircd -n -d /dev/lirc0 --output /dev/lircd $LASTCMD" -#echo $LCMD - exec $LCMD >>$LOG 2>>$LOG - fi + printhl " Device Dvico" + /usr/sbin/lircd -r -n -d /dev/lirc0 --output /dev/lircd $LASTCMD >>$LOG 2>>$LOG + fi + else + LCMD="/usr/sbin/lircd -r -n -d /dev/lirc0 --output /dev/lircd $LASTCMD" + #echo $LCMD + exec $LCMD >>$LOG 2>>$LOG + fi fi fi diff --git a/abs/core/runit-scripts/runitscripts/services/mdadm/run b/abs/core/runit-scripts/runitscripts/services/mdadm/run index 0ab432e..567332e 100755 --- a/abs/core/runit-scripts/runitscripts/services/mdadm/run +++ b/abs/core/runit-scripts/runitscripts/services/mdadm/run @@ -1,19 +1,10 @@ -#!/bin/bash
-#
-# Start Monitoring software raid arrays
-exec 2>&1
-export TERM=linux
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PID=`pidof -o %PPID /sbin/mdadm`
- stat_runit "Starting mdadm RAID Monitor"
- if [ -z "$PID" ]; then
- /sbin/mdadm -F -s
- fi
- if [ ! -z "$PID" -o $? -gt 0 ]; then
- stat_fail
- else
- add_daemon mdadm
- stat_done
- fi
+#!/bin/bash +# +# Start Monitoring software raid arrays +exec 2>&1 +export TERM=linux +. /etc/rc.conf +. /etc/rc.d/functions + + stat_runit "Starting mdadm RAID Monitor" + exec /sbin/mdadm -F -s diff --git a/abs/core/runit-scripts/runitscripts/services/nmbd/run b/abs/core/runit-scripts/runitscripts/services/nmbd/run index 9ed032b..976cfc1 100755 --- a/abs/core/runit-scripts/runitscripts/services/nmbd/run +++ b/abs/core/runit-scripts/runitscripts/services/nmbd/run @@ -6,4 +6,4 @@ export TERM=linux stat_runit "Starting NMBD" -exec nmbd -F -S -d1 2>/dev/null >/dev/null +exec nmbd -F 2>/dev/null >/dev/null diff --git a/abs/core/runit-scripts/runitscripts/services/postfix/run b/abs/core/runit-scripts/runitscripts/services/postfix/run new file mode 100755 index 0000000..1fa526e --- /dev/null +++ b/abs/core/runit-scripts/runitscripts/services/postfix/run @@ -0,0 +1,8 @@ +#!/bin/bash +exec 1>&2 +export TERM=linux +. /etc/rc.conf +. /etc/rc.d/functions + +stat_runit "Starting postfix" +exec /usr/lib/postfix/master -D diff --git a/abs/core/runit-scripts/runitscripts/services/smbd/run b/abs/core/runit-scripts/runitscripts/services/smbd/run index b4a545b..0fe0516 100755 --- a/abs/core/runit-scripts/runitscripts/services/smbd/run +++ b/abs/core/runit-scripts/runitscripts/services/smbd/run @@ -6,4 +6,4 @@ export TERM=linux stat_runit "Starting Samba" -exec smbd -F -S -d3 2>/dev/null >/dev/null +exec smbd -F 2>/dev/null >/dev/null |