2

My problem is I am not able to run script automaticlly when modem is connected.

I need a code to be run when my modem is detected. I am having a photon modem and I am using sakis3g script to connect to internet. I have to run sudo sakis3g connect in terminal to connect my modem. I have made this code to run without password by editing sudoers list. After that I can connect modem by just typing sudo sakis3g connect in terminal.

I was reading this post about run a script automatically when usb is mounted and was following steps.

my lsusb output is like enter image description here

modem is ZTE WCDMA Technologies MSM

I noted down ID "19d2:1254"

ran command sudoedit /etc/udev/rules.d/mount-modem.rules

edited rules to

 ACTION=="add", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1254", RUN+="/home/bibi/bin/modem.sh"

my modem.sh is

enter image description here

I am able to run modem.sh from terminal and connect modem.

enter image description here

But when usb modem is removed and connected script is not running. I dont know whether I missed anything.

Thanks

Edit. It is working.... No changes were made. Problem was delay was a little more that made me think not working. Thank you

Bibi424
  • 618

2 Answers2

0

Your problem is probably that sakis3g is not in a default location. Modify your script to use the full path. For example, if sakis3g is in your $HOME/bin folder, make your script look like this:

#!/bin/bash
sleep 6
/home/bibi/bin/sakis3g connect
terdon
  • 104,119
0

It is working. Whatever steps I followed was correct. No changes were made. Problem was delay was a little more that made me think not working.

Also it was running without any notification. Normally a window will pop up with 'connecting' dialogue when I run sakis3g to connect internet. No notifications like 'connected' also I am getting as showed in question.

But on plugging modem it is getting connected automatically to internet in few seconds. :)

Thank you

Bibi424
  • 618