Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- if [ ! -e /tmp/usb_modeswitch.conf ];then
- cat >/tmp/usb_modeswitch.conf<<EOF
- DefaultVendor=0x1a8d
- DefaultProduct=0x2000
- TargetVendor=0x1a8d
- TargetProduct=0x2006
- MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
- MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
- ReleaseDelay=4000
- NeedResponse=1
- EOF
- fi
- if [ ! -e /tmp/pppd.options ];then
- cat >/tmp/pppd.options<<EOF
- defaultroute
- usepeerdns
- noipdefault
- noauth
- persist
- maxfail 3
- holdoff 10
- ipcp-max-failure 30
- lcp-echo-interval 30
- lcp-echo-failure 3
- crtscts
- 921600
- connect "/usr/sbin/chat '' ATZ OK ATD*99***1# CONNECT ''"
- user 'username'
- password 'password'
- /dev/ttyACM0
- EOF
- fi
- if [ ! -e /tmp/redial.sh ];then
- cat >/tmp/redial.sh<<EOF
- #!/bin/sh
- while true;do
- sleep 120
- if ! ping -c1 inet.host.to.ping.com >/dev/null 2>&1;then
- killall pppd
- /tmp/dial.sh &
- fi
- done
- EOF
- chmod 700 /tmp/redial.sh
- fi
- usb_modeswitch -c /tmp/usb_modeswitch.conf >/tmp/usb_modeswitch.out 2>&1
- COUNT=0
- while [ ! -c /dev/ttyACM1 ];do
- let COUNT=$COUNT+1
- [ $COUNT -ge 60 ]&&exit 1
- sleep 1;done
- sleep 1
- COMGTPIN=0000 comgt -d /dev/ttyACM0 PIN >/tmp/comgt-pin.out 2>&1
- sleep 1
- pppd file /tmp/pppd.options
- ps|grep '[r]edial.sh' >/dev/null||/tmp/redial.sh &
Advertisement
Add Comment
Please, Sign In to add comment