Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
http://www.thefanclub.co.za/how-to/how-auto-connect-u...
How to auto connect Ubuntu 12.04 USB GSM Mobile Broadband Connection on Boot as startup service without user login using Network Manager CLi
Submitted by The Fan Club on 15 April 2012
Requirements:
Ubuntu 12.04 LTS machine with a USB GSM 3G Modem
Add the following into the startup script file and save: Note: Replace the YourMobileBroadbandConnectionNameHere with the name of your connection. In this case our service provider is: 8ta Note: If you want the script to also auto re-connect the connection if lost rather use version 2. Note: If you do not see a codeblock right below this text or see a small empty box before step 3 please reload this page. 27 28 29 30 31 32 33
while true; do # testing... LC_ALL=C nmcli -t -f TYPE,STATE dev | grep -q "^gsm:disconnected$ if [ $? -eq 0 ]; then break else # no GSM modem detected yet, sleeping for a second
1 of 4
http://www.thefanclub.co.za/how-to/how-auto-connect-u...
The script is registered as a system startup service so you can start, stop, or check the status of the script with :
6. Troubleshooting.
If it does not connect on startup the most likely problem is that the connection is not available to all users at startup. Click on "Edit Connections..." in the Network Connections Manager dialog window, select Mobile Broadband, select your connection, and click on "Edit". Make sure that the "Available to all users" is selected and click on Save
2 of 4
http://www.thefanclub.co.za/how-to/how-auto-connect-u...
connection if it finds the modem disconnected for some reason. Edit the script file created in step 2, by opening a terminal window and entering:
Then replace the original code with the code below and save: Note: Replace the YourMobileBroadbandConnectionNameHere with the name of your connection. In this case our service provider is: 8ta 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/bin/sh # Mobile Broadband Autoconnect Service script v2.0 alpha # acts as startup service script for nmcli to autoconnect # NOTE: use the name of the Mobile Connection in the Netw # USAGE: start|stop|status # ### BEGIN INIT INFO # Provides: mobile-broadband-connect # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Should-Start: $network # Should-Stop: $network # Default-Start: 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Autoconnect 3G GSM ### END INIT INFO NAME="mobile-broadband-connect" DESC="Autoconnect 3G/4G GSM USB modem at startup" test -x $DAEMON || exit 0 case "$1" in
Download:
Attachment mobile-broadband-connect-0.1.tar.gz mobile-broadband-connect-2.0.tar.gz Size 854 bytes 1.06 KB
Tags: Ubuntu GSM Mobile Broadband Mobile Broadband Connection nmcli Network Manager 3G USB 3G Modem Auto connect Startup Script BASH Ubuntu 12.04
3
Like
1
Tweet share
to post comments
7259 reads
(http://www.ubuntu.com/)
3 of 4
http://www.thefanclub.co.za/how-to/how-auto-connect-u...
4 of 4