av singer » lør 28.04.2012 0:43
Takk for svar men ubuntu 12.04 fungerer ikke. I 11.10 fant den mobiltbredbånd med engang ,finner ikke betegnelsen mobiltbredbånd under nettverk heller i 12.04?
fant denne men kan ikke bruke terminal MÅ være programerer nesten får å få til dette.Huff
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
This guide is intended as a relatively easy step by step mostly graphical (GUI) guide to:
• Create a auto start bash script to start the mobile broadband connection at boot time as a startup service without needing to log in as a user.
Requirements:
• Ubuntu 12.04 LTS machine with a USB GSM 3G Modem
--------------------------------------------------------------------------------
1. Setup a new Mobile Broadband Connection and connect.
• After you have set up a new Mobile Broadband Connection it will appear in the network connections (click on taskbar network icon).
• In this case our new connection name is : 8ta
•Connection 'name' should contain only alpha-numerical characters and no spaces to avoid problems.
• Make sure the "Enable Mobile Broadband" is activated. (see below)
• Connect to the internet with your Mobile Broadband connection by clicking on the connection name. In this case 8ta
2. Create a Network Manager CLi startup script for your connection.
• Open the Terminal Window and enter :
sudo gedit /etc/init.d/mobile-broadband-connect• Add the following into the startup script file and save:
• Note: Replace the <Your Mobile Broadband Connection Name Here> with the name of your connection. In this case our name is: 8ta
#!/bin/bash
# CD Mobile Broadband Startup Service script v1.0 beta by CD April 2012
# acts as startup service script for Network Manager Command Line - NMCLI
# We use nmcli to fire up Mobile Broadband Connections when the GSM device is detected on boot
# NOTE: use the name of the Mobile Connection as defined in the Network Manager as the 'id'
# USAGE: start|stop|status
#
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
3. Change the startup script file permissions.
• By default a new file is not allowed to be executed - so we need to modify the permissions to allow us to run the script at startup..
• Open the Terminal Window and enter :
sudo chmod +x /etc/init.d/mobile-broadband-connect
4. Update system startup defaults to include your new script as a service.
• To update the startup services, open the Terminal Window and enter :
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 startsudo service mobile-broadband-connect stopsudo service mobile-broadband-connect status
5. 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.
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