Open terminal window and type:
sudo gedit /etc/init.d/mobile-broadband-connect
Then copy and paste this (Change for your needs):
Note: Replace the <Your Mobile Broadband Connection Name Here> with the name of your connection.
#!/bin/bash
case "$1" in
start)
      echo "Starting Mobile Broadband Connection."
      while true; do
        # testing...to see if gsm is on the list of active devices
        LC_ALL=C nmcli -t -f TYPE,STATE dev | grep -q "^gsm:disconnected$"
        if [ $? -eq 0 ]; then
            break
        else
         # not connected, sleeping for a second
            sleep 1
        fi
      done
      # now once GSM modem shows up, run these commands
      nmcli -t nm wwan on
      nmcli -t con up id <Your Mobile Broadband Connection Name Here>
;;
stop)
      echo "Stopping Mobile Broadband Connection."
      nmcli -t con down id <Your Mobile Broadband Connection Name Here>
      nmcli -t nm wwan off
;;
status)
      # Check to see if the process is running with Network Manager dev status
      nmcli -p dev
;;
*)
      echo "Mobile Broadband Startup Service"
      echo $"Usage: $0 {start|stop|status}"
      exit 1
esac
exit 0
Change the permissions of this file for execution:
sudo chmod +x /etc/init.d/mobile-broadband-connect
To run this script has a service, do:
sudo update-rc.d mobile-broadband-connect defaults
The script is registered as a system startup service so you can start, stop, or check the status of the script with :
sudo service mobile-broadband-connect start
sudo service mobile-broadband-connect stop
sudo service mobile-broadband-connect status
Reboot to complete installation and auto connect.
- Reboot your system to complete the installation.
- After reboot it takes up to 60 seconds before the USB device is active.
- When active - The Mobile Broadband Connection will be activated and auto connected.
Done ...