Linux Hotplug development
 help / color / mirror / Atom feed
* problem executing command substitution from udev rules
@ 2010-11-02  6:46 J. Bakshi
  2010-11-02  9:51 ` Andrey Borzenkov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: J. Bakshi @ 2010-11-02  6:46 UTC (permalink / raw)
  To: linux-hotplug

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
 
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-03 15:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-02  6:46 problem executing command substitution from udev rules J. Bakshi
2010-11-02  9:51 ` Andrey Borzenkov
2010-11-02 11:49 ` J. Bakshi
2010-11-03 13:17 ` Dan Nicholson
2010-11-03 15:50 ` J. Bakshi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox