Jump to content

astranger

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by astranger

  1. You guys have done a pretty good job with the sleep script. On the waking up front I am looking at modifying this code to run on my router, pfSense. This script is intended for DD-WRT based routers. It waits for a request to an ip:port combo. In this example a request to IP 192.168.1.101 on port 80 will cause the script to run. The script pings 192.168.1.101, if no reply then it sends WOL. To adapt this for CIFS (SMB) use port 445 and the IP of the unRaid server. Issues I see up front are the timeout of CIFS before unRAID can respond and if the HTPC has already resolved the MAC of the unRaid system. Not sure what to do other then try it. If the MAC has already been resolved by the HTPC then a request may never go to the router triggering a WOL. WORKAROUND: Place a DD-WRT router between HTPC (main network) and unRAID. Downside might be serious bandwidth limitations depending on the DD-WRT hardware and another point of complexity. On the upside I could have added security protecting my file server. If unRAID does not respond before the CIFS timeout then just try again. I host a couple of other services on my unraid box so if I can get this working for CIFS then everything else should be a breeze. If I get this working I can post walk through. For the standby scripting, any plan to create an unMenu package? From: http://www.dd-wrt.com/wiki/index.php/Useful_Scripts#Web_Server_Wake-up #!/bin/sh #Enable JFFS2 and place script in /jffs/ then run on startup in web interface. #You can check the log from http://192.168.1.1/user/wol.html INTERVAL=5 NUMP=3 OLD="" PORT=80 WOLPORT=9 TARGET=192.168.1.101 BROADCAST=192.168.1.255 MAC=00:11:22:33:44:55 WOL=/usr/sbin/wol LOGFILE="/tmp/www/wol.html" echo "<meta http-equiv=\"refresh\" content=\"10\">" > $LOGFILE echo "AUTO WOL Script started at" `date` "<br>" >> $LOGFILE while sleep $INTERVAL;do NEW=`dmesg | awk '/ACCEPT/ && /DST='"$TARGET"'/ && /DPT='"$PORT"'/ {print }' | tail -1` SRC=`dmesg | awk -F'[=| ]' '/ACCEPT/ && /DST='"$TARGET"'/ && /DPT='"$PORT"'/ {print $7}' | tail -1` LINE=`dmesg | awk '/ACCEPT/ && /DST='"$TARGET"'/ && /DPT='"$PORT"'/'` if [ "$NEW" != "" -a "$NEW" != "$OLD" ]; then if ping -qc $NUMP $TARGET >/dev/null; then echo "NOWAKE $TARGET was accessed by $SRC and is already alive at" `date` "<br>">> $LOGFILE else echo "WAKE $SRC causes wake on lan at" `date` "<br>">> $LOGFILE $WOL -i $BROADCAST -p $WOLPORT $MAC >> $LOGFILE echo "<br>" >> $LOGFILE sleep 5 fi OLD=$NEW fi done
×
×
  • Create New...