LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 09-17-2010, 09:26 AM   #1
linuxmandrake
Member
 
Registered: Sep 2004
Distribution: debian sarge 64bit (AMD)
Posts: 709

Rep: Reputation: 30
O2 HSPA mobile broadband auto connect using script over ssh


Hi
I;'m wondering how can I get it to automatically connect as soon as it detects the modem. It uses modem manager to connect. I use Gnome network manager applet to connect to o2. However I would rather it run in the background. The pc hosting this connect doesn't have a monitor and so am relying on SSH. Since ssh sessions can't be kept alive it disconnects when the session is closed. I'm too cheap to buy another monitor.
 
Old 09-18-2010, 05:12 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
Quote:
Originally Posted by linuxmandrake View Post
Since ssh sessions can't be kept alive it disconnects when the session is closed.
Use screen and then the session won't be disconnected.
 
Old 09-22-2010, 01:44 AM   #3
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,665

Rep: Reputation: Disabled
In Networkmanager you have the choice to activate automatic connection.
 
Old 09-22-2010, 10:34 AM   #4
linuxmandrake
Member
 
Registered: Sep 2004
Distribution: debian sarge 64bit (AMD)
Posts: 709

Original Poster
Rep: Reputation: 30
Yes but the connection doesn't stay on when I close the applet. Is there a way the network manager daemon can automatically connect for me. I.e. similar to what it does for Ethernet wired connections.
 
Old 09-22-2010, 11:20 AM   #5
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,665

Rep: Reputation: Disabled
Huh? Networkmanager is a daemon AFAIK, it can run detached in the background.
 
Old 09-22-2010, 11:43 AM   #6
joenew
LQ Newbie
 
Registered: Mar 2010
Distribution: slackware 14.0
Posts: 21

Rep: Reputation: 6
Mmmm, why don't create a "daemon-script', or create a simple script and run it in a screen session?
I'm using pppd scripts to connect ("pppd call mobile" for example is the comand I launch).
I writen a chat script and put it in /etc/ppp, for example /etc/ppp/mobile.chat
Then is needed a pppd script in /etc/ppp/peers.

Code:
$ cat /etc/ppp/peers/mobile
/dev/rfcomm0 9600
connect '/usr/sbin/chat -v -f /etc/ppp/mobile.chat'
noauth
novj
novjccomp
mru 1500
mtu 1500
debug
defaultroute

$ cat /etc/ppp/gprs.chat
'' \d
'' 'atz'
OK 'at+cgatt=1'
OK 'at+cgdcont=1,"IP","your.apn.there"'
OK 'atd*99***1#'
Ok, that's all, "chmod +x" to thoose scripts and launch pppd call mobile as root to connect.
But you want a script that lanch connection command:

Code:
#!/bin/sh
while [ 1 ]
do
  if lsusb |grep $product_key_of_your_modem"
  then
    pppd call mobile
  fi
  sleep 5
done
This is a very simple and bugged example.
You could decide to simply check if connection is up or not and eventually connect.
I'm running a script like that to automatically keep my system online through a bluetooth cellular modem.
I just control if ppp0 interface is up or not and if not connect even if my modem is not in the BT range. In tath case connection just doesn't happens and it just sleep 5 seconds before redo a check.

It's quite simple and you don't need any X server running nor gnome or kde and so on.
 
Old 09-22-2010, 05:17 PM   #7
linuxmandrake
Member
 
Registered: Sep 2004
Distribution: debian sarge 64bit (AMD)
Posts: 709

Original Poster
Rep: Reputation: 30
THANKS ALOT U THE MAN. It's works like a charm. Now I'll be battling with udev to get the modem to stop disappearing.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to connect tata photon+ mobile broadband service in redhat el5? pranava Red Hat 3 04-22-2010 01:02 AM
t-mobile mobile broadband stick with linux on eee pc beagle21 Linux - Laptop and Netbook 2 07-15-2009 12:04 PM
ssh auto login script zerocool22 Linux - Server 4 05-13-2008 09:43 PM
Connect ssh with auto auth Drunkalot Linux - Networking 1 01-19-2005 06:43 AM


All times are GMT -5. The time now is 03:17 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration