LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-22-2011, 09:47 PM   #1
lpallard
Senior Member
 
Registered: Nov 2008
Posts: 1,045

Rep: Reputation: Disabled
irexec not executing commands


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!

Last edited by lpallard; 05-22-2011 at 09:49 PM.
 
Old 06-01-2011, 07:55 PM   #2
lpallard
Senior Member
 
Registered: Nov 2008
Posts: 1,045

Original Poster
Rep: Reputation: Disabled
Anybody?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How commands are executing ? gsiva Linux - Server 1 07-21-2009 08:48 AM
Executing commands at a specified time Siva4Linux Linux - Wireless Networking 7 02-21-2007 05:49 AM
TCL executing commands riotxix Programming 1 12-30-2006 12:10 AM
Executing commands in Konsole... meteotrade Linux - General 5 10-20-2003 06:34 PM
Executing commands on startup viciousfish Linux - General 5 06-28-2002 02:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration