0

I've been trying to get my udev rule to work for a few hours now and it's just not working. The rule is supposed to launch a new terminal and run my script. I've tried running a script from the udev rule to open a new terminal first, but also to run the new terminal straight from the udev rule. Neither is working. Oddly enough running mkdir does work using the same rules which leads me to believe I'm doing something wrong elsewhere.

This is my udev rule:

ACTION=="add", SUBSYSTEM=="usb", DRIVER=="usb", RUN+="/usr/bin/gnome-terminal -x /home/[user]/Desktop/script.sh"

Running tail -f /var/log/syslog shows the script failing with exit code 1, which doesn't really help. Any suggestions would be much appreciated.

1
  • Why do you need to assign a virtual terminal to the program? Can't it just run without one? Jan 31, 2017 at 23:56

1 Answer 1

0

You're not seeing anything because udev runs in a context that doesn't have the $DISPLAY variable set, which is mandatory for something like gnome-terminal to know how to contact the X server. You can add --display=:0 to the command line in the rule, or write a wrapper script that sets DISPLAY and then calls gnome-terminal.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .