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 use, and love, GNOME Do. Sometimes, though, it crashes and I have to re-run it from the menu. Is it possible to set up my GNOME session to automatically try to respawn Do?

I realize there are some caveats contemplating this - if my system gets into a state where Do cannot run at all, this would create an infinite loop of respawning, crashing, and respawning again, but in my experience Do crashes just enough for it to be slightly annoying, and never right after I restart it manually.

If someone can make a case for this being a bad idea, I'd consider that a good answer as well.

share|improve this question
    
possible duplicate ubuntu.stackexchange.com/questions/4628/gnome-do-stops-working –  Decio Lira Sep 26 '10 at 20:59
    
you may want to troubleshoot the problem instead of just working around it. There is a discussion already about it in the question I mention above. If the problem cannot be solved, personally I would bind a keyboard shortcut to restart Gnome-Do, although you seem to be looking for a more automated solution. –  Decio Lira Sep 26 '10 at 21:03
add comment

1 Answer 1

up vote 2 down vote accepted

You should be able to start it with a bash script that's basically "while(1){gnome-do}", ensuring that when gnome-do crashes, it gets run again. As long as gnome-do is run synchronously, it should work just fine. even if the system gets into a state where it can't be launched successfully, the impact would be small. If you want to ensure that even that is not a problem, insert a command using zenity. This would notify you that there was a problem, and require you to hit enter to start gnome-do again.

create a script with the following and launch it from the "Startup Applications" application found under the System Preferences menu.

while true
do
  gnome-do
  zenity --info --text="gnome-do crashed ... press enter to restart"
done
share|improve this answer
1  
That was a clever idea. I modified your script to the following: <code>while true; do gnome-do 2>> /home/username/gnome-do.log if [ "$?" -ne "0" ]; then notify-send --urgency=low --icon=gnome-do "GNOME-Do has crashed." "The cause of the crash has been logged to ~/gnome-do.log." else break fi done</code> Assuming that GNOME-Do exits with a non-zero exit code upon crashing, the script should notify me with a notification bubble and restart GNOME-Do. If I exit Do normally, it won't be restarted (if I ever want to get rid of it temporarily). STDERR goes to a log for debugging. –  Tin Tvrtković Sep 27 '10 at 22:34
    
(It would appear I suck at formatting comments, but you get the gist of it) –  Tin Tvrtković Sep 27 '10 at 22:37
    
I do, excellent idea, I think I'll actually run it myself. –  Nerdfest Sep 28 '10 at 0:14
add comment

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.