problem executing command substitution from udev rules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello llist,
 
I am using notify-send in my udev rules to send desktop notification.   Here is the actual command which is working fine for me, even from the root shell.
 
 ````````````
 /bin/su `ps aux | grep startx | grep '/bin/sh' | awk '{print $1}'` -c "DISPLAY=:0.0 notify-send  "test"
 `````````````
 
the part  [ ps aux | grep startx | grep '/bin/sh' | awk '{print $1}' ] is for collecting the user-name who is running startx. 
 
now in my udev rule if I hard-coded the user name like 
 
 ```````````````
 ACTION=="add", SUBSYSTEM=="input", ENV{ID_CLASS}="mouse", ENV{DISPLAY}=":0.0", ENV{XAUTHORITY}="/home/user1/.Xauthority"  RUN+="/bin/su  user1 -c "DISPLAY=:0.0 notify-send "test" "
 ``````````````````````````
 
 it works well.  But if I try to add command substitution ( with in back-qoutes ) to dynamically collect the user name , it stops working. The rule is like
 
```````````````
 ACTION=="add", SUBSYSTEM=="input", ENV{ID_CLASS}="mouse", ENV{DISPLAY}=":0.0", ENV{XAUTHORITY}="/home/user1/.Xauthority"  RUN+="/bin/su  `ps aux | grep startx | grep '/bin/sh' | awk '{print $1}'`  -c "DISPLAY=:0.0 notify-send "test"  "
 ``````````````````````````
 
Definitely I have user1 who is using startx here. Surely the command substitution with in udev rules is not working at all. Can't understand why it fails. I would be grateful if any one point out what is missing/wrong here.
 
Thanks
 
 
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux