Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Feature Request: VDR server online times programmable ->nvram-wakup



On Thu, 25 Mar 2004 10:00:51 +0100, gfiala@s.netic.de wrote:

> As this often came up before - is there a collection of shutdown and other
> scripts or at least snippets to be used with nvram-wakup?

I use the script below for a very long time now and everything works
perfect. 

Emil
#!/bin/bash
# $Id: vdrshutdown,v 1.10 2002/03/15 22:25:38 bistr-o-math Exp $

NVRAMCMD=/usr/local/bin/nvram-wakeup
$NVRAMCMD -d > /dev/null 2>&1
$NVRAMCMD -ls $1 
case $PIPESTATUS in
     0) # all went ok - new date and time set
        shutdown -h now
        EXITSTATUS=0
        ;;

     1) # all went ok - new date and time set.
        #
        # *** but we need to reboot. ***
        #
        # for some boards this is needed after every change.
        #
        # for some other boards, we only need this after changing the
        # status flag, i.e. from enabled to disabled or the other way.
        
        
        # For plan A (see README file for more details) - uncomment
        #            the touch line (don't forget to change your boot script)
        #            and comment out the lilo line
        #
        # For plan B - uncomment the lilo line and comment out the touch line
        #            (don't forget to install the modified kernel image first)
        #
        # touch /nvramboot

        if [ `who | wc -l` != 0 ]
        then
            logger -i -t vdrshutdown "Shutdown canceled, users logged in ..."
            EXITSTATUS=1
        elif rpcinfo -p multitainer > /dev/null 2>&1
	then
            logger -i -t vdrshutdown "Shutdown canceled, multitainer active ..."
            EXITSTATUS=1
        elif rpcinfo -p missmarple > /dev/null 2>&1
	then
            logger -i -t vdrshutdown "Shutdown canceled, missmarple active ..."
            EXITSTATUS=1
        elif egrep -q 'resync|recovery' /proc/mdstat > /dev/null 2>&1
	then
            logger -i -t vdrshutdown "Shutdown canceled, resync/recovery in progress ..."
            EXITSTATUS=1
        else
#	    touch /video/.scan
	    touch /video/.fsck
            lilo -R PowerOff
            shutdown -r now
        fi
        EXITSTATUS=0
        ;;

     2) # something went wrong
        # don't do anything - just exit with status 1
        EXITSTATUS=1
        ;;
esac

# exit with 0 if everything went ok.
# exit with 1 if something went wrong.
exit $EXITSTATUS


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index