gharris999;585398 Wrote: > Thanks for that. > > I'm not really sure how hwclock determines if the hardware clock is set > to local or to UTC. But if the time reported by hwclock appears to be > UTC, then, yes, you should use %d rather than %l. > > Re end-of-day action: yes the plugin is supposed to treat the EOD > action as a "alarm" and schedule a system wake-up IF the action is set > to a custom script and IF the EOD idle-timeout is set to zero. E.g., > with my Fedora system, I use the following SrvrPowerCtrl settings: > > Perform end-of-day action? check > Allowed idle time (minutes): 0 > End-of-day start & end times (HH:MM): 2:00 AM, 2:05 AM > Custom end-of-day action command: sudo /usr/local/sbin/spc-update.sh > > With these settings, the server gets woken up at 1:55 AM and then fires > off the /usr/local/sbin/spc-update.sh script at 2:00 am. That script > shuts down SBS (I'm running from the 7.6 svn code, so it's: service > squeezeboxserver_trunk stop), updates the SBS svn code (svn up > /usr/share/squeezeboxserver_trunk/server), updates the operating system > (yum update -y) and then reboots the system. > > If you want to have your EOD script perform similar sorts of chores, > make sure you add an entry for the script in the /etc/sudoers file. > > Here is the similar sort of script I use with my ubuntu server. You'll > want to clean this up a bit: > > > Code: -------------------- > > > #!/bin/bash > clear > #---------------------------------------------------------------- > # Vars: > NOREBOOT=0 > WIPEDB=0 > SPCLOGFILE="" > SVNLOGFILE=/var/log/squeezeboxserver_trunk/svn.log > UDAPSVNLOGFILE=/usr/local/sbin/Net-UDAP/svn.log > TMPFILE=$( /bin/mktemp -t ) > APTFILE=$( /bin/mktemp -t ) > MYNAME="your_em...@your_isp.net" > MYOS=`uname -r` > HOST=`hostname` > SERVICE=`/bin/ps ax | grep " /usr/sbin/squeezeboxserver "` > > #---------------------------------------------------------------- > # Update prep.. > > /bin/echo "Updating Squeezebox Server and operating system $MYOS.." > > for ARG in $* > do > case $ARG in > --noreboot) > NOREBOOT=1 > echo 'System WILL NOT reboot..' > ;; > > --wipedb) > WIPEDB=1 > echo 'SBS db file WILL BE wiped..' > ;; > *) > esac > done > > #---------------------------------------------------------------- > # Stop squeezeboxserver.. > > if (( $(echo $SERVICE | egrep -c "/usr/bin/perl") >= 1 )) > then > SPCLOGFILE=/var/log/squeezeboxserver/srvrpowerctrl.log > /usr/sbin/service squeezeboxserver stop > else > SPCLOGFILE=/var/log/squeezeboxserver_trunk/srvpowerctrl.log > /usr/sbin/service squeezeboxserver_trunk stop > fi > > #/bin/echo "SPC Logging to $SPCLOGFILE.." > #/bin/echo "SVN Logging to $SVNLOGFILE.." > #/bin/echo "MSG Logging to $TMPFILE.." > #/bin/echo "Service == $SERVICE" > > > #---------------------------------------------------------------- > # Construct message header: > > /bin/echo return-path: $MYNAME >> $TMPFILE > /bin/echo for: $MYNAME >> $TMPFILE > /bin/echo from: $MYNAME >> $TMPFILE > /bin/echo to: $MYNAME >> $TMPFILE > /bin/echo "subject: $HOST server update status report" >> $TMPFILE > > /bin/echo $0 start: $( /bin/date +%c ) >> $TMPFILE > /bin/echo $0 start: $( /bin/date +%c ) >> $SPCLOGFILE > > #---------------------------------------------------------------- > # Update the svn code.. > /bin/echo 'Checking for squeezeboxserver_trunk svn updates...' > /bin/echo Svn update of squeezeboxserver_trunk was run: $( /bin/date +%c ) >> $TMPFILE > /bin/echo Svn update of squeezeboxserver_trunk was run: $( /bin/date +%c ) >> $SPCLOGFILE > /bin/echo Svn update of squeezeboxserver_trunk was run: $( /bin/date +%c ) >> $SVNLOGFILE > /usr/bin/svn up /usr/share/squeezeboxserver_trunk/server >>$SVNLOGFILE > echo 'Fixing file permissions...' > chown -R squeezeboxserver:nogroup /etc/squeezeboxserver_trunk > chown -R squeezeboxserver:nogroup /usr/share/squeezeboxserver_trunk > chown -R squeezeboxserver:nogroup /var/lib/squeezeboxserver_trunk > chown -R squeezeboxserver:nogroup /var/log/squeezeboxserver_trunk > > #---------------------------------------------------------------- > # Update the Net-UDAP... > > echo 'Checking for UDAP updates..' > /bin/echo Svn update of UDAP was run: $( /bin/date +%c ) >> $TMPFILE > /bin/echo Svn update of UDAP was run: $( /bin/date +%c ) >> $SPCLOGFILE > /bin/echo Svn update of UDAP was run: $( /bin/date +%c ) >> $UDAPSVNLOGFILE > /usr/bin/svn up /usr/local/sbin/Net-UDAP >> $UDAPSVNLOGFILE > > > #---------------------------------------------------------------- > # Update the OS (and any apt installed squeezeboxserver.. > > /bin/echo APT-GET Update was run: $( /bin/date +%c ) >> $TMPFILE > > /bin/echo >> $TMPFILE > /bin/echo -n "Result: " >> $TMPFILE > > /bin/echo 'Running apt-get update..' > > /usr/bin/apt-get -qy update > /dev/null > > /bin/echo 'Running apt-get dist-upgrade..' > > /bin/echo APT-GET dist-upgrade was run: $( /bin/date +%c ) >> $TMPFILE > /bin/echo APT-GET dist-upgrade was run: $( /bin/date +%c ) >> $SPCLOGFILE > > #/usr/bin/apt-get -qy --force-yes dist-upgrade | grep -i installed >> $TMPFILE > /usr/bin/apt-get -qy --force-yes dist-upgrade >> $APTFILE > /bin/cat $APTFILE >> $TMPFILE > /bin/cat $APTFILE >> $SPCLOGFILE > /bin/echo >> $TMPFILE > /bin/echo $0 finished: $( /bin/date +%c ) >> $TMPFILE > > > #---------------------------------------------------------------- > # Since we're using squeezeboxserver_trunk running as a service from > # svn code, disable the apt installed squeezeboxserver service.. > > /usr/sbin/sysv-rc-conf squeezeboxserver off > > > #---------------------------------------------------------------- > /bin/echo 'Sending report...' > > /bin/cat $TMPFILE | sendmail -t > > /bin/rm $TMPFILE > > /bin/echo $0 finished: $( /bin/date +%c ) >> $SPCLOGFILE > > > if (( WIPEDB == 1 )) > then > echo 'Wiping SBS db files!' > rm -f /var/lib/squeezeboxserver/cache/*.db > rm -f /var/lib/squeezeboxserver_trunk/cache/*.db > ls -l /var/lib/squeezeboxserver/cache > fi > > echo 'Done!' > > #restart the system > if (( NOREBOOT != 1 )) > then > echo 'Waiting 10 seconds to reboot the system..' > sleep 10 > /sbin/shutdown -r now > fi > > exit 0 > > -------------------- > >
Aha, I had missed that the EOD idle time has to be set to 0 in order for the custom script to run. Thanks. And thank you for the script. Will test this out tonight! -- tuc ------------------------------------------------------------------------ tuc's Profile: http://forums.slimdevices.com/member.php?userid=34475 View this thread: http://forums.slimdevices.com/showthread.php?t=48521 _______________________________________________ plugins mailing list [email protected] http://lists.slimdevices.com/mailman/listinfo/plugins
