irexec - how can I get it to keep alive/restart after resume from suspend/hibernate?
#1
Question 
Hey guys,

finally got my general suspend problem fixed, so I am able to put my machine to sleep just fine now. Now the next problem is "irexec". I use it to assign remote buttons in ubuntu 9.04 to specific actions, e.g. start xbmc, or shutdown the PC.
Problem is, after resuming, irexec process is gone and thus my mapped buttons in .lircrc don't work.
I tried adding restart scripts in /etc/pm/sleep.d and/or in /etc/acpi/resume.d (what is the difference between these dirs btw?). But irexec don't seem to restart. I think there might be a problem anyway. Since irexec is started by the gnome startup applications manager at bootup, I would have to restart it the same way, thus ubuntu still has the same display assigned to it.
Anyway, if someone who uses irexec + suspend/resume could give me some tipps that would be great ...

thanks

boba
Reply
#2
Does it work if you manually run the script (kill + start irexec)?
I have seen that other people having problem with lirc after resume and you may need relead also lirc.
Reply
#3
Hey man,

lircd is not the problem, I got that working rock solid, meaning after suspend and resume remote inside xbmc (which is not managed by irexec or irxevent) is working perfectly fine. Its just my mappings for "outside" xbmc, e.g. start xbmc from ubuntu desktop or shutdown the system while on the desktop don't work. Since these are handled by mappings in .lircrc / irexec.

But anyway, I DO restart lircd and unload / reload it's modules anyway, since without that, my machine refuses to go into standby more than once per session ;-) Though lirc is restarted anyway.

If I run the script manually in /etc/pm/sleep.d it seems to work, though not always I think, it seems a bit unreliable.
pm-suspend.log shows the script running as well, with no obvious errors .... strange. And irexec IS restarted, I can tell from the changing process ID. Could it still be a X / Display variable problem? I exported DISPLAY=:0.0 in the scripts I wrote ...

boba
Reply
#4
Alright, I think I got irexec to reload after resume now. I can shutdown my machine from the Ubuntu desktop just fine with the assigned button from .lircrc, which didn't work before after resume. Still I cannot use all my assigned buttons from .lircrc, the button for launching xbmc does nothing. Only after resume. After a clean boot the button works. irexec is running, as I said, shutdown button works.
Here is my .lircrc:

# Start XBMC
begin
prog = irexec
button = PCPower
config = /home/boba/scripts/startXBMC.sh
end

# Kill XBMC
begin
prog = irexec
button = TV
config = /home/boba/scripts/killXBMC.sh
end

# Shutdown
begin
prog = irexec
button = Red
config = sudo /home/boba/scripts/shutdown.sh
end

and here is my "startXBMC.sh" script which is assigned to the button that won't work after resume:

#!/bin/bash

export XBMC_HOME=/usr/share/xbmc

export DISPLAY=:0

# debug

echo "XBMC Start Script ran ..." > /home/boba/start.txt

# Test to see if XBMC is running first
if ps -ef|grep -v grep|grep -i xbmc.bin
then
# Do nothing
echo "XBMC already Running!"
else
# Startup XBMC
echo "XBMC Starting up NOW !!!" >> /home/boba/start.txt
gnome-screensaver-command -i &
/usr/bin/xbmc && killall -15 gnome-screensaver-command
#/usr/bin/xbmc
fi

exit

You can see the debug echos that I put in which shows me, that the button actually works, after each press the file "start.txt" is created and the expected text is in there.
Question now is, why xbmc won't launch.
From a ssh shell e.g. I can run the script just fine with:

export DISPLAY=:0 ; startXBMC.sh

So why won't xbmc start when triggered by script via irexec (only after resume)?

thanks for any help guys ...

boba
Reply
#5
I am facing same problem with irexec being dead after resume from suspend on 9.10 32bit.
Everything works except this. I can provide all needed information if someone is willing to help a bit.
I had defeated so many issues with all this lirc/remote/suspend/resume thing and now there is only one left...
Reply
#6
sollarman Wrote:I am facing same problem with irexec being dead after resume from suspend on 9.10 32bit.
Everything works except this. I can provide all needed information if someone is willing to help a bit.
I had defeated so many issues with all this lirc/remote/suspend/resume thing and now there is only one left...

Hey,

as I already wrote you via email, I am using monit to monitor the process and restart it if it dies. I didn't find another solution yet.

boba
Reply
#7
For a solution that recovers from both a reboot, a standby/resume, as well as random irexec crashes (and works without relying on Gnome functionality), I think I've finally figured it out and posted the answer on my blog. I combed all of the common answers (this being one of the top Google responses), but couldn't find a solution that quite covered everything. Check it out and let me know if anyone has problems with the steps posted. Hopefully this helps!

TechNazgul: Using and Autostarting irexec
------------------------------------------
Dharma Quick Setup Guide:
XBMC tips on the TechNazgul Blog
------------------------------------------
Reply

Logout Mark Read Team Forum Stats Members Help
irexec - how can I get it to keep alive/restart after resume from suspend/hibernate?0