PaulofOz Posted May 18, 2018 Share Posted May 18, 2018 I am trying to understand and construct a script that will run my 3g usb modem at startup. I have great difficulty in understanding the syntax. I am using a PI PC+ with Ubuntu Xenial. If I type the following at the command prompt: Quote sakis3g --sudo connect --sudo USBINTERFACE="3" --sudo APN="telstra.internet" My modem connects to the internet. Sakis3g is located in /home/opi/usr/local/bin/sakis3g. Can someone offer guidance or an example that would execute the above command at startup please? Link to comment Share on other sites More sharing options...
PaulofOz Posted June 2, 2018 Author Share Posted June 2, 2018 1.) So I have sakis3g installed 2.) So I created a file : sudo nano /etc/sakis3g.conf with the following info: Quote USBINTERFACE="3" APN="telstra.internet" MODEM="19d2:0031" 3.) I created an autconnectnet script - sudo nano /etc/init.d/autoconnectnet with the following: Quote #*************************************************** #! /bin/sh # /etc/init.d/autoconnectnet ### BEGIN INIT INFO # Provides: noip # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Simple script to start a program at boot # Description: A simple script from www.stuffaboutcode.com which will start / stop a program a boot / shutdown. ### END INIT INFO case "$1" in start) sleep 10 echo "connecting via sakis3g" # run application you want to start /usr/local/bin/sakis3g --sudo "connect" ;; stop) echo "dissconnecting via sakis3g" # kill application you want to stop /usr/local/bin/sakis3g --sudo "disconnect" ;; *) echo "Usage: /etc/init.d/autoconnectnet {start|stop}" exit 1 ;; esac exit 0 #********************************************************* If I type: sudo /etc/init.d/autoconnectnet start or sudo /etc/init.d/autoconnectnet stop it starts and stops no problems. 4.) Now, when I switch the power off and back on, this .conf file seems to get corrupted or modified. The following is displayed when try to go back to this entry - sudo nano /etc/sakis3g.conf and the editor is blank. Quote Error reading lock file /etc/.sakis3g.conf.swp: Not enough data read What am I doing wrong? I want the modem to start after powering on. Link to comment Share on other sites More sharing options...
Igor Posted June 2, 2018 Share Posted June 2, 2018 What about this way:https://github.com/armbian/config/commit/433e49755c9f8b72eabded1de2b5ee64dde5edba Link to comment Share on other sites More sharing options...
PaulofOz Posted June 2, 2018 Author Share Posted June 2, 2018 :-) sorta right under my nose. I have cloned Armbian/config to my OPi. I went into /config folder and chmod +x the files but I cannot get the Debian-config menu system to show. Link to comment Share on other sites More sharing options...
Igor Posted June 2, 2018 Share Posted June 2, 2018 43 minutes ago, PaulofOz said: :-) sorta right under my nose. I have cloned Armbian/config to my OPi. I went into /config folder and chmod +x the files but I cannot get the Debian-config menu system to show. You can set it from a menu if you have exactly this Huawei 909 modem. I took the script from @Stanislav Sinyagin https://txlab.wordpress.com/ who is dealing more with those 3G/4G modems. Just try to make it up/down the same way. Link to comment Share on other sites More sharing options...
PaulofOz Posted June 11, 2018 Author Share Posted June 11, 2018 On 6/2/2018 at 5:07 PM, Igor said: What about this way:https://github.com/armbian/config/commit/433e49755c9f8b72eabded1de2b5ee64dde5edba My OS crashed and seemed to no longer load beyond a certain point. So, I have reinstalled the .img along with PIAWARE. All is good. I have cloned the latest Armbian configuration and install utility but now I am lost? Is this meant to run from entering on the command line : sudo delian-config . Sudo armbian-config takes me to the old configuration utility that does not contain the LTE modem option. Link to comment Share on other sites More sharing options...
Igor Posted June 11, 2018 Share Posted June 11, 2018 2 hours ago, PaulofOz said: Sudo armbian-config takes me to the old configuration utility that does not contain the LTE modem option. This functionality is not yet arrived into the armbian-config stable package. Scripts are specifically designed for a modem which I have around (armbian-config will show you options to connect only if you have one of supported), for others init scripts, you need to look at @Stanislav Sinyagin blog. I sent you this link to peek into the code and DIY. Link to comment Share on other sites More sharing options...
Recommended Posts