Hello,
I have setup lirc on my htpc and it works perfectly, but I am trying to use irexec to execute commands from my remote controller, and this does not work.
Basically, I loosely based my setup on this thread at the XBMC forums
(starting at step 3 because lirc is configured and runs the Slackware way !):
http://forum.xbmc.org/showthread.php?t=30230
The thread on XBMC's forum uses irexec and irxevent to execute commands. I am not 100% sure why irxevent is used but I am interested to know why and what it really does...
In the meantime my .lircrc file looks like:
Code:
# Start XBMC
begin
remote = harmony2
prog = irexec
button = key_media
config = /usr/bin/startxbmc.sh
end
#
# Shutdown PC
begin
remote = harmony2
prog = irexec
button = key_sleep
config = shutdown -h now
end
The script /usr/bin/startxbmc.sh works perfectly so I know the problem is not there. I also added a simple line like 'date > /home/user/date.txt' to create a text file containing the date in my home folder, but this file does not get created so I believe irexec does not even execute the script.
Also, irexec and irxevent are started from a line in rc.local which calls the following script:
/usr/bin/startirexec.sh which contains:
Code:
#!/bin/bash
# Test to see if IRXevent is running first, if so kill it, then restart
if ps -ef|grep -v grep|grep -i irxevent
then
ps aux|grep -i youruser|grep -i irxevent |awk '{print $2}'|xargs kill
else
# Do nothing
echo "irxevent already dead!"
fi
# Test to see if IRexec is running first, if so kill it, then restart
if ps -ef|grep -v grep|grep -vi start|grep -i irexec
then
ps aux|grep -i youruser|grep -i irexec |grep -vi start|awk '{print $2}'|xargs kill
else
# Do nothing
echo "irexec already dead!"
fi
#test to see if an instance of irxevent is already running
if ps -ef|grep -v grep|grep irxevent
then
# do nothing
echo "irxevent already running"
else
# start irxevent
irxevent /home/youruser/.lircrc &
fi
#test to see if an instance of irexec is already running
if ps -ef|grep -v grep|grep irexec
then
# do nothing
echo "irexec already running"
else
# start irxevent
irexec -d /home/youruser/.lircrc &
fi
exit
Now this script did not work (at least in slackware). I tried to run it manually, it outputs all kind of weird stuff and tries to kill too much stuff as well so I did not take any chance and simplified (commented out all lines) and replaced them with only
Code:
irexec -d /home/user/.lircrc &
irxevent /home/user/.lircrc &
but irxevent wouldnt start normally. My understanding is that irxevent uses the display of the parent owner (in my case root since it is called from rc.local) so I tried to start it as normal user and it worked.
So on top of my problem executing commands with irexec, I would like to know how to execute a process as a different user so I can have irxevent started as a normal user by the system at boot time?
Anybody can provide pointers ?
THanks!