3G USB Modem Script


#1

If I enter the following at the command line my usb 3g modem will connect to the internet.

sakis3g --sudo connect --sudo USBINTERFACE=“3” --sudo APN=“telstra.internet”

I tried the below script called: /etc/init.d/modem-on - with the following content:

#!/bin/sh
sleep 1.2m ;
exec /home/opi/usr/local/bin/sakis3g --sudo connect --sudo USBINTERFACE=“3” --sudo APN=“telstra.internet”
exit 0

It did not work on startup. What am I doing wrong? I want to insert the usb, turn the power on and walk away from a remote feeder.


Data logger
#2

V1.) So I have sakis3g installed

2.) So I created a file : sudo nano /etc/sakis3g.conf with the following info:

USBINTERFACE=“3”
APN=“telstra.internet”
MODEM=“19d2:0031”

3.) I created an autconnectnet script - sudo nano /etc/init.d/autoconnectnet with the following:

#***************************************************
#! /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.

I also added sudo update-rc.d autoconnectnet defaults

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.

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.


#3

My computer ended up with issues so I have restarted afresh.