Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want an app to re-start (XBMC, but I failed with Firefox and Krusader doing this, too), after the PC wakes from suspend or hibernate. I want to write a script, which runs at the same conditions, and checks the network I am connected to, and execute.( mount my NFS)
I tried with

sudo touch /etc/pm/sleep.d/99_RestartXBMC
sudo chmod a+x /etc/pm/sleep.d/99_RestartXBMC
sudo nano /etc/pm/sleep.d/99_RestartXBMC

and

#!/bin/bash
case "$1" in
    thaw)
       killall -9 xbmc.bin ;;
       sleep 5 ;;
       /usr/bin/xbmc ;;
    *)
        ;;
esac
exit $?

But XBMC will not start ( Firefox and Krusader, too)
So, I want to define an upstart script, that will execute after system resume (from hibernate or sleep) I want to be something like

start on xxxxx (xxx should be start from hibernate or sleep)

Dont if it is possible to make something like that, anf if so how to define correctly the xxxxx condition

start on system resume ????
start on system thaw ???
share|improve this question

1 Answer 1

up vote 2 down vote accepted

My knowledge of Upstart is limited but according to the Upstart FAQ you have to rely on gnome-powermanager emitting an event that Upstart can act upon.

I do not know if gnome-pm currently uses libupstart but I'm sure this could be done by adding an upstart emit event to the sleep.d scripts that Upstart would react to.

Actually I wonder if your sleep.d script resume problems are related to running as root instead of user, this will affect Upstart too. You can check pm-suspend.log with Log File Viewer for errors.

share|improve this answer
    
So, what kind of permission combination do you propose to set the script? –  deckoff May 21 '11 at 15:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.