3

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?

2 Answers 2

4

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.

1
  • I think this is the most reliable way to do this. Thanks!
    – mattmac
    Apr 11, 2011 at 20:50
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .