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
  • 6
  • 13
  • 1
    if you want to show people the answer, you can provide an answer yourself and mark it as the accepted answer. Editing the title with "[SOLVED]" is not how these stackexchange sites work. – glenn jackman May 05 '14 at 17:57
  • Any idea @Avinash What should I do here ? http://askubuntu.com/questions/461867/not-able-to-connect-to-the-internet-using-huawei-e303-datacard – Arup Rakshit May 06 '14 at 18:14

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
  • 100,812
  • I think problem is here because when I changed ACTION=="add", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1254", RUN+="/home/bibi/bin/modem.sh" to ACTION=="add", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1254", RUN+="firefox". Then also modem mount not causing firefox to launch. – Bibi424 May 05 '14 at 16:21
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
  • 6
  • 13