Hi there,
I am trying to use the script here:
https://github.com/RMerl/asuswrt-merlin/wiki/WOL-Script-Wake-Up-Your-Webserver-On-Internet-Traffic
Everything has been filled in but it does not seem to be working.
I tried running wake.sh manually but get below error:
The code I am using:
Is the script outdated?
Thanks.
I am trying to use the script here:
https://github.com/RMerl/asuswrt-merlin/wiki/WOL-Script-Wake-Up-Your-Webserver-On-Internet-Traffic
Everything has been filled in but it does not seem to be working.
I tried running wake.sh manually but get below error:
Code:
: not foundts/wake.sh: line 2:
: not foundts/wake.sh: line 12:
/jffs/scripts/wake.sh: line 29: syntax error: unexpected "done" (expecting "then")
The code I am using:
Code:
#!/bin/sh
INTERVAL=5
NUMP=3
OLD=""
TARGET=192.168.1.100
PORT=80
IFACE=br0
MAC=MYMAC
WOL=/usr/bin/ether-wake
LOGFILE="/var/log/ether-wake.log"
while sleep $INTERVAL;do
NEW=`dmesg | awk '/ACCEPT/ && /DST='"$TARGET"'/ && /DPT='"$PORT"'/ {print }' | tail -1`
SRC=`echo $NEW | awk -F'[=| ]' '{print $8}'`
DPORT=`echo $NEW | awk -F'[=| ]' '{print $27}'`
PROTO=`echo $NEW | awk -F'[=| ]' '{print $23}'`
if [ "$NEW" != "" -a "$NEW" != "$OLD" ]; then
if ! ping -qc $NUMP $TARGET >/dev/null; then
# echo "NOWAKE $TARGET was accessed by $SRC, port $DPORT, protocol $PROTO and is already alive at" `date`>> $LOGFILE
# else
echo "WAKE $TARGET requested by $SRC, port $DPORT, protocol $PROTO at" `date`>> $LOGFILE
$WOL -i $IFACE $MAC
sleep 5
fi
OLD=$NEW
fi
done
Is the script outdated?
Thanks.