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'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

2 Answers 2

up vote 4 down vote accepted

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

URL='http://localhost/site/'

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

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

 
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.