daily pastebin goal
84%
SHARE
TWEET

lte-connect.sh

josephxsxn Jun 30th, 2017 (edited) 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. timstim=$(date -u)
  3. interface=wwan0
  4. usbdevice=/etc/usb_modeswitch.d/12d1\:1505
  5. qmidevice=/dev/cdc-wdm0
  6. string=$(sudo qmi-network $qmidevice status | grep disconnected)
  7. if [[ $string == *"disconnected"* ]]; then
  8.     echo "{\"TIMSTIM\" : \""$timstim"\", \"LTE\" : [{\"NETWORK_STATE\":\"DISCONNECTED\"}]}"
  9.     sudo qmi-network $qmidevice stop
  10.     sudo qmi-network $qmidevice start
  11.     sudo dhclient -r $qmidevice
  12.     sudo dhclient $qmidevice
  13.     sleep 10
  14.     string=$(sudo qmi-network $qmidevice status | grep connected)
  15.     if [[ $string == *"connected"* ]]; then
  16.         echo "{\"TIMSTIM\" : \""$timstim"\", \"LTE\" : [{\"NETWORK_STATE\":\"CONNECTED\"}]}"
  17.     else
  18.         echo "{\"TIMSTIM\" : \""$timstim"\", \"LTE\" : [{\"NETWORK_STATE\":\"UNKNOWN_ISSUE_RECONNECTING\"}]}"
  19.         sudo usb_modeswitch -c $usbdevice
  20.     fi
  21. else
  22.     string=$(sudo qmi-network $qmidevice status | grep connected)
  23.     if [[ $string == *"connected"* ]]; then
  24.         echo "{\"TIMSTIM\" : \""$timstim"\", \"LTE\" : [{\"NETWORK_STATE\":\"CONNECTED\"}]}"
  25.     else
  26.         echo "{\"TIMSTIM\" : \""$timstim"\", \"LTE\" : [{\"NETWORK_STATE\":\"UNKNOWN_ISSUE_RECONNECTING\"}]}"
  27.         sudo usb_modeswitch -c $usbdevice
  28.     fi
  29. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top