1

Can't get what's wrong with my udev rule and bash script. I want to make simple test on usb device insertion.

This is my rule /etc/udev/rules.d/90-usb.rules:

ACTION=="add", RUN+="/home/mike/notification.sh"

And this is my script /home/mike/notification.sh:

#!/bin/bash
echo 'message:Hello!' | zenity --notification --listen

Just from terminal this command works fine.

mr.boris
  • 253
  • 3
  • 13
  • did you make your script executable by `chmod +x /home/mike/notification.sh` ? – kenn Oct 17 '17 at 11:35
  • Yes, I did. I can run it from terminal like this `/home/mike/notification.sh` and it works, but with udev it doesn't. – mr.boris Oct 17 '17 at 11:42
  • Try radu's answer here https://askubuntu.com/questions/297412/how-do-i-make-udev-rules-work – kenn Oct 17 '17 at 12:38
  • Why? I added this rule `ACTION=="add", RUN+="/home/mike/notification.sh"`, so it should trigger the command on **add** event. Correct me if i wrong, please. – mr.boris Oct 17 '17 at 12:38
  • place your script in `/lib/udev` – kenn Oct 17 '17 at 12:40
  • I think problem stems from `udev` redirection as @user.dz suggested in the above link. – kenn Oct 17 '17 at 12:46
  • try it like `ACTION=="add", RUN+="/bin/sh /home/mike/notification.sh"` – kenn Oct 17 '17 at 12:51

0 Answers0