Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to create my own Linux distro in LiveCD format. I have put a webserver in my Linux LiveCD, and make it automatically startup during boot time.

I have made the LiveCD to auto-login to desktop environment without requiring user to type in their password.

Now, I would like to configure the web browser to automcatically pop-up during startup and show the homepage of the webserver.

I have tried different methods but i found that when user boot up the LiveCD, most of the time the desktop environment and the web browser will be shown before the webserver finished starting up. As a result, the web browser will show an error page "webpage not found/not available".

After a few seconds (after the webserver finished starting up), if the user click at the refresh button, they will be able to see the homepage.

How can I make sure that the webserver has been started up before the desktop environment is shown to the user?

Thanks.

share|improve this question

2 Answers 2

You can, for example, use some sort of script like this:

    #!/bin/bash

    # Check existence of webserver pidfile
    pidfile="/var/run/nginx.pid"

    if [ -f $pidfile ]; then
            echo "Pidfile exists"
            < OPEN BROWSER >
    else
            echo "Web Server isn't started"
    fi
share|improve this answer

A shell script similar to one posted by @hangover would work.

If this is only a race about couple of seconds, then another approach would be to create a local HTML file and set that as a start-up page for your web browser with a path like file:///var/www/html/localhost/startingup.html. The page itself would say "Please wait while I'm finishing the startup, this will take only a short moment", and then forward itself to your actual web page after, say, 30 seconds.

<html>
<head>
     <title>Starting up...</title>
     <meta http-equiv="refresh" content="30; http://your.actual.page/">
</head>
<body>
     <h1>Please wait, I'm still starting up.</h1>
</body>
</html>
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.