sms 474 B

123456789101112131415161718192021222324252627282930
  1. #!bin/bash
  2. source /etc/clara.sh
  3. sms(){
  4. echo "to: $nn">q.txt
  5. echo hi>>q.txt
  6. echo "i'm clara. a server Manager bot">>q.txt
  7. echo "the server Internet Connection is lost">>q.txt
  8. cp q.txt /var/spool/sms/outgoing.
  9. rm q.txt
  10. }
  11. # Apply test and execute on result
  12. test_log(){
  13. if [ -f lostconnection.lock ]
  14. then
  15. echo "Lockfile in place"
  16. else
  17. sms
  18. fi
  19. }
  20. PINGS=`ping -c 1 -i 2 $your_gateway | wc -l`
  21. if [ $PINGS -lt 6 ]
  22. then
  23. echo q
  24. touch lostconnection.lock
  25. else
  26. echo "All is well"
  27. fi