I know ... this sounds like an easy one, but I have done my homework and tried tons of stuff. It doesn't work. This is not a typical "kill $pid" solution.

I want a script to run when the machine is booted, which will prompt the user to make some initial config settings. However, the user may only do this once - during installation, and the server will likely be headless after that. So, I need the script to timeout.

Here is my approach:

1. A script called launch.sh is executed from rc.local on each boot. All it does, is launch prompt.sh, grab its process ID and kill it after 5 seconds.

2. The prompt.sh script simply asks the user if they want to run a setup utility (called test.sh). If they don't respond in 5 seconds, the prompt.sh script is killed by launch.sh. If they respond with a 'Yes', then the prompt.sh script executes test.sh and then terminates. In this case, when launch.sh tries to terminate prompt.sh, it shouldn't be running anymore - so it doesn't matter.

3. The test.sh script should now be running if the user answered 'Yes' to the prompt.sh script.

Now, here is where things go wrong. When launch.sh terminates prompt.sh, it messes up the screen and the ability of the user to interact with the test.sh dialog.

Why?

The scripts are very short and simple. See below. Just edit the few paths and give it a whirl to see what I mean.

#!/bin/bash # # --------------------------------------------------------------------- # This script is executed by launch.sh. If the user has not responded # to the yes/no prompt in the set time, then launch.sh will terminate # this script so that the normal boot may continue. # ---------------------------------------------------------------------

Who is online

Users browsing this forum: Google [Bot] and 11 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum