Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/"

my is

enter image description here

I am able to run 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.


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

share|improve this question
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 5 '14 at 17:57
Any idea @Avinash What should I do here ?… – Arup Rakshit May 6 '14 at 18:14

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:

sleep 6
/home/bibi/bin/sakis3g connect
share|improve this answer
I think problem is here because when I changed ACTION=="add", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1254", RUN+="/home/bibi/bin/" to ACTION=="add", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1254", RUN+="firefox". Then also modem mount not causing firefox to launch. – Bibi424 May 5 '14 at 16:21
up vote 0 down vote accepted

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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