> I am, please post your details. > > Robert Wooden > Nashville, TN. USA
These are my changes to Salik Rafiq's original script: - Added args 3 and 4 to ping (bit of a hack) - Replaced ethwake with wakeonlan - Look up individual hardware addresses from files created with "arp -a machine > machine.wol" for simplicity - Save state of machine - Directory is hardcoded to /usr/tools/wol for no particular reason ============== #!/bin/bash #this script is totally designed for the backuppc ping command #which is the first thing it does before it starts a backup #this is a substitute which pings the machine, if it is not #awake then it wakes it using a magic packet - using the wol.bsh script #then pings again to make sure PING=/bin/ping ARG1=$1 ARG2=$2 ARG3=$3 ARG4=$4 WAKEHOST=$5 ETHWAKE=/usr/bin/wakeonlan SLEEPTIME=3m logger "Backuppc pinging $1 $2 $3 $4 $5" function getwol { if [ -f /usr/tools/wol/$1.wol ]; then $hwaddr = $(cat /usr/tools/wol/$1.wol | cut -d" " -f4) else logger "No MAC address for $1" exit -1 fi } function fwol { TO_WAKEUP=$1 getwol $1 sudo $ETHWAKE $hwaddr } $PING $ARG1 $ARG2 $ARG3 $ARG4 $WAKEHOST >>/dev/null 2>&1 if [ $? -ne 0 ]; then fwol $WAKEHOST if [ "$WOL_RES" = "FAIL" ]; then exit 1 fi echo "OFF" > /usr/tools/wol/$WAKEHOST.state sleep $SLEEPTIME $PING $ARG1 $ARG2 $WAKEHOST if [ $? -eq 0 ] then logger "success waking $WAKEHOST." else logger "unable to wake $WAKEHOST." exit 1 fi else $PING $ARG1 $ARG2 $ARG3 $ARG4 $WAKEHOST echo "ON" > /usr/tools/wol/$WAKEHOST.state fi exit 0 =========== This is the postusercmd.sh I use for every windows box: #!/bin/bash WINEXE=/usr/bin/winexe UNAME="Username" PWD="Password" WRKGRP="WORKGROUP" BOX=$1 PID=$($WINEXE -U $UNAME -W $WRKGRP --password=$PWD //$BOX 'cmd /c echo '1' > c:\backuppc\wake.up') echo "Rsync and shadow copy unloaded" if [ -f /usr/tools/wol/$BOX.state ]; then read wasoff << /usr/tools/wol/$BOX.state if [ "$wasoff" -eq "OFF" ]; then $WINEXE -U $UNAME --password=$PWD //$BOX 'shutdown -f -s -c "Backup Complete"' fi fi ============== The original is from http://www.goodjobsucking.com/?p=62 -- only the last bit that reads the machine state and shuts it down cleanly has been added. (Works on XP and Windows 7.) ------------------------------------------------------------------------------ Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev _______________________________________________ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net List: https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki: http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/