Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

new Linux user here (Ubuntu 12.04)... I've been looking on google and found some scripts that would make what I'm about to ask easier but what I would like to do is write a script that automatically opens terminal and runs the command 'easytether connect' when I connect my phone to the computer... Is there any way to do this?

share|improve this question
    
Did you try Googling for udev rules? Lots of tutorials. –  ubfan1 Oct 7 '13 at 2:47

1 Answer 1

  1. Check the udev attributes for target device (if you know it). Example:

    udevadm info -a -n /dev/ttyACM0
    

    Or monitor udev events (then plug your device):

    udevadm monitor --environment --udev
    
  2. Use specific attributes to match target device and Create new udev rules file in /etc/udev/rules.d/. Use ACTION=="add" to match device added event and RUN+="..." to run needed script. Example

    ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth0", RUN+="/usr/bin/ethtool -s eth0 wol d"
    

References:

share|improve this answer

Your Answer

 
discard

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.