#!/bin/sh
# $Id: start_neutrino,v 1.30 2006/07/23 12:21:37 barf Exp $
date -s 010101001970
sectionsd
timerd
#camd2
/var/emu/gbox.ppc &
zapit
controld
nhttpd
until neutrino -f -u ; do
echo "Neutrino exited with nonzero exit status, restarting..."
pidof sectionsd >/dev/null || sectionsd
pidof timerd >/dev/null || timerd
pidof camd2 >/dev/null || camd2
pidof zapit >/dev/null || zapit
pidof controld >/dev/null || controld
pidof nhttpd >/dev/null || nhttpd
done
[ -e /tmp/tuxmaild.pid ] && kill $( cat /tmp/tuxmaild.pid )
[ -e /tmp/tuxcald.pid ] && kill $( cat /tmp/tuxcald.pid )
[ -e /var/run/automount.pid ] && kill -TERM $( cat /var/run/automount.pid )
pzapit -kill
i=9
while expr $i != 0 > /dev/null
do
if pidof controld > /dev/null; then echo "Waiting for controld (max. $i seconds)"
elif pidof timerd > /dev/null; then echo "Waiting for timerd (max. $i seconds)"
elif pidof zapit > /dev/null; then echo "Waiting for zapit (max. $i seconds)"
elif pidof tuxmaild > /dev/null; then echo "Waiting for tuxmaild (max. $i seconds)"
elif pidof tuxcald > /dev/null; then echo "Waiting for tuxcald (max. $i seconds)"
else break;
fi
i=`expr $i - 1`
sleep 1
done
if [ -e /tmp/.nohalt ] ; then
killall -q sectionsd
killall -q timerd
killall -q camd2
killall -q zapit
killall -q controld
killall -q nhttpd
saa --fbas
switch -fnc 0 -fblk 0
echo "Neutrino and its daemons terminated (hopefully)"
exit
fi
if [ -e /tmp/.reboot ] ; then
reboot
else
halt
fi