Guest User

dial.sh

a guest
Sep 20th, 2012
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.27 KB | None | 0 0
  1. #!/bin/sh
  2. if [ ! -e /tmp/usb_modeswitch.conf ];then
  3. cat >/tmp/usb_modeswitch.conf<<EOF
  4. DefaultVendor=0x1a8d
  5. DefaultProduct=0x2000
  6. TargetVendor=0x1a8d
  7. TargetProduct=0x2006
  8. MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
  9. MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
  10. ReleaseDelay=4000
  11. NeedResponse=1
  12. EOF
  13. fi
  14. if [ ! -e /tmp/pppd.options ];then
  15. cat >/tmp/pppd.options<<EOF
  16. defaultroute
  17. usepeerdns
  18. noipdefault
  19. noauth
  20. persist
  21. maxfail 3
  22. holdoff 10
  23. ipcp-max-failure 30
  24. lcp-echo-interval 30
  25. lcp-echo-failure 3
  26. crtscts
  27. 921600
  28. connect "/usr/sbin/chat '' ATZ OK ATD*99***1# CONNECT ''"
  29. user 'username'
  30. password 'password'
  31. /dev/ttyACM0
  32. EOF
  33. fi
  34. if [ ! -e /tmp/redial.sh ];then
  35. cat >/tmp/redial.sh<<EOF
  36. #!/bin/sh
  37. while true;do
  38. sleep 120
  39. if ! ping -c1 inet.host.to.ping.com >/dev/null 2>&1;then
  40. killall pppd
  41. /tmp/dial.sh &
  42. fi
  43. done
  44. EOF
  45. chmod 700 /tmp/redial.sh
  46. fi
  47. usb_modeswitch -c /tmp/usb_modeswitch.conf >/tmp/usb_modeswitch.out 2>&1
  48. COUNT=0
  49. while [ ! -c /dev/ttyACM1 ];do
  50. let COUNT=$COUNT+1
  51. [ $COUNT -ge 60 ]&&exit 1
  52. sleep 1;done
  53. sleep 1
  54. COMGTPIN=0000 comgt -d /dev/ttyACM0 PIN >/tmp/comgt-pin.out 2>&1
  55. sleep 1
  56. pppd file /tmp/pppd.options
  57. ps|grep '[r]edial.sh' >/dev/null||/tmp/redial.sh &
Advertisement
Add Comment
Please, Sign In to add comment