Advertisement
YouRik

Auto power-off script for SMB Server (PS2)

Jun 15th, 2017
366
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None
  1. #! /bin/bash
  2.  
  3. while true
  4. do
  5. sleep 60
  6. if ping -c 1 192.168.10.10 &> /dev/null
  7. then
  8. echo connected
  9. else
  10. echo not connected
  11. for i in 1 2 3 4 5
  12. do
  13. sleep 10
  14. echo retry $i
  15. if ping -c 1 192.168.10.10 &> /dev/null
  16. then
  17. echo reconnected
  18. break
  19. else
  20. echo still no answer
  21. if [ $i -eq 5 ]
  22. then
  23. echo powering off
  24. sleep 2
  25. poweroff
  26. fi
  27. fi
  28. done
  29. fi
  30. done
Advertisement
RAW Paste Data Copied
Advertisement