You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
423 B

7 years ago
  1. IP="192.168.1.120"
  2. MAC="70:8B:CD:A7:07:78"
  3. /usr/sbin/wol -i 192.168.1.255 -p 9 $MAC > /dev/null
  4. ping -c 1 $IP > /dev/null
  5. res=$?
  6. count=0
  7. stime=`date +%s`
  8. while [ $res -ne 0 ]
  9. do
  10. /usr/sbin/wol -i 192.168.1.255 -p 9 $MAC > /dev/null
  11. let count++
  12. ping -c 1 $IP > /dev/null
  13. res=$?
  14. done
  15. etime=`date +%s`
  16. time=`expr $etime - $stime`
  17. echo "Tries: $count"
  18. if [ $count -gt 0 ]
  19. then
  20. echo "Time: $time"
  21. fi
  22. exit