Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a ubuntu kiosk that on boot loads up a local web app in firefox. I'm booting gnome and firefox too quickly. We need to wait about 30 seconds after it loads up and then need to hit refresh on the browser for the application to load properly.

What's the best way to slow this down a bit. Ideally I'd like it to come up after we get a 200 success code from apache. Should I have a shell script that doesn't return true until it gets a 200? Or maybe for now a script that does a sleep 60 before gnome loads?

Where's the best place to put a script to slow down gnome/firefox bootup?

share|improve this question
up vote 4 down vote accepted

I'd personally try something like this in a script:


while [[ $(wget -O /dev/null $URL 2>&1|egrep "200 OK"|wc -l) == "0" ]]; do
    sleep 10;

firefox $URL

This isn't tested so may need a little work.

Just as an explanation, that monster line requests the page with wget and looks for a 200 OK status code in the wget output. It counts the lines of output so you should only ever get 0 or 1 as the return.

Every time it gets 0 (that is wget didn't have a 200 OK response) it's told to sleep for 10 seconds. After that nap it loops back around.

share|improve this answer
I think this is the most reliable way to do this. Thanks! – mattmac Apr 11 '11 at 20:50

To define a session that runs a script before starting the desktop environment and applications we may create a User Defined Session where we could script anything needed.

share|improve this answer

Your Answer


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.