ed...@pettijohn-web.com (Edgar Pettijohn), 2017.04.23 (Sun) 23:59 (CEST):
> I'm working on a gui tool for mounting usb sticks.  I want it to launch from
> hotplugd, but so far I am unsuccessful.
> 
> #/etc/hotplug/attach
> 
> #!/bin/sh
> 
> DEVCLASS=$1
> 
> DEVNAME=$2
> 
> 
> case $DEVCLASS in
> 
>     2)
> 
>         /usr/local/bin/xmount.py /dev/"$DEVNAME"a
> 
>         ;;
> 
> esac
> 
> 
> The script is executable.  However, the log shows "child exit status: 1" and
> the program doesn't startup.  If I run "xmount.py /dev/sd1a" from an xTerm
> it works as expected. Is there some special magic I need to add to the
> attach script?

I do:

_xsess_pid=$(pgrep -f -x "/bin/sh /etc/X11/xenodm/Xsession")
_xsess_usr=$(ps -a -p $_xsess_pid -o user)
# newline on purpose!
_xsess_usr=${_xsess_usr#USER
}

/usr/bin/su -l -s /bin/sh ${_xsess_usr} -e \
  -c "env DISPLAY=:0 /usr/local/bin/xwhatever" 

Marcus

> !DSPAM:58fd23df199499728819562!

Reply via email to