Automatic script for usb not working in ubuntu

My objective is to run the script automatically when usb-dongle is inserted . I looked into other links in google for the same but just can't get it work . Script is running fine manually but doesn't run when usb dongle is inserted .
Below are the details for the same . Please someone suggest what am i missing ?


1.
meher@meher-Compaq-620:~$ lsusb
Bus 002 Device 011: ID 12d1:14db Huawei Technologies Co., Ltd.


2. Script is
meher@meher-Compaq-620:~$ ls -lrt ~/mtsdongle.sh
-rwxrwxrwx 1 root root 92 Mar 11 22:27 /home/meher/mtsdongle.sh

meher@meher-Compaq-620:~$ cat ~/mtsdongle.sh
#! /bin/sh
notify-send "****** *****"
env > /tmp/env.out


3. rules is
meher@meher-Compaq-620:/etc/udev/rules.d$ pwd
/etc/udev/rules.d


meher@meher-Compaq-620:/etc/udev/rules.d$ ls -lrt
-rwxrwxrwx 1 root root 116 Mar 11 22:32 77-mts.rules

meher@meher-Compaq-620:/etc/udev/rules.d$ cat 77-mts.rules
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", ATTR{idProduct}=="14db", RUN+="/home/meher/mtsdongle.sh"

Tagging #-Link-Snipped-# for help .

Replies

  • Abhishek Rawal
    Abhishek Rawal
    Everything looks good, it should work. But sometimes minute things creates havoc.
    Have you tried restarting udev service ?
    sudo etc/init.d/udev restart
    and also don't forget to make shell script an executable
    chmod 755 /home/meher/mtsdongle.sh

    If still problem exists, do comment. We'll help you out 😀
  • Akash Yadav
    Akash Yadav
    It worked fine 😁 though it seems notify-send doesn't work with root .

    Thanks a lot #-Link-Snipped-# .

You are reading an archived discussion.

Related Posts

Ideata Analytics is a computer software company founded by Pranjal Jain in the year 2013. A big data intelligence platform, Ideata Analytics provides an end-to-end, highly intuitive analytical application which...
Hi , currently i am working in infrastructure domain as wintel level1 support from past 1 year .but i want to change my domain (as it is 24/7) where i...
Hi Feels great to express our opinions and clear doubts. Am currently working as MIS Analyst for more than a year in a BPO industry. However am looking to change...
Hello Everyone, I'm back here. 😍 As this is my final year of BSc IT,I have received job offer from Igate as well as TCS. Igate is giving me position...
Project Abstract / Summary : In project work, we are used to make different models of pressure vessel in Creo Parametric 2.0 design software with proper attachment of nozzle by...