0

RP-beginner here,

Background

I'm using a shell script called Sakis3g to connect to internet and it works very well (It uses wvdial in the background and sets up a ppp-connection)

I want Sakis3g to run automatically and connect to a USB-modem (D-Link DWM-222) when the raspberry is booted to enable me to SSH into it from another computer. I know this can be done in multiply ways, such as placing the command in rc.local or init.d.

The problem

The thing is that the network I'm connecting to is not the public internet but hosted locally at a site. This network is not always available and the "sudo sakis3g connect" would fail.

What I want

I want to know that the modem has found the network before executing the "sudo sakis3g connect"

Question

What is the best way to go about this? Is there any way to trigger the command upon network identification? Or should I just keep running the command until it succeeds?

  • What is Sakis3g? The USB-modem is connected to a USB port of the RasPi? Where is the Sakis3g connected and how? Why do you need Sakis3g in addition to a modem? – Ingo Jul 7 at 10:57
  • Thank you for replying. Sakis3g is a shell script that connects the USB-modem to 3G or 4G (LTE). So it is no hardware but just a script for connection. I want this script to run once the modem has found the network. – parvelmarv Jul 7 at 11:21
  • "I want to know that the modem has found the network before executing the "sudo sakis3g connect"" - This is done at startup. If then the network isn't available, you do not have a connection until you boot again, right? – Ingo Jul 7 at 18:37
  • Found a solution! :) See above – parvelmarv Jul 8 at 13:37
  • 1
    Congratulations on solving the problem yourself. Please consider adding it as an answer to your own question; you can even accept it later. That way, others having a similar problem can immediately see that an answer exists, which might help them solve their problem faster. – AdminBee Jul 8 at 13:53
1

SOLUTION

In the source folder of Sakis3g there was a file that could be disassembled - modified - and compiled. The timeout threshold was set to 20sec in this file and by changing it to a higher number Sakio3g kept searching for the connection until the usb-modem found a network connection.

Code

/urs/bin/sakis3g disassemble /tmp  
cd /tmp/sakis3g-0.2.0e/  
vim src/sakis3g # Search for network and find registration loop
./compile  
cp /tmp/sakis3g-0.2.0e/build/sakis3gz /usr/bin/sakis3g. 
| improve this answer | |
  • 2
    Thank you. I will take the liberty then to remove the "solution" part from your question, now that you have posted it as an answer. – AdminBee Jul 9 at 13:21
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. – Ingo Jul 15 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.