I have a pre-configured server based on Debian with some services. I, now, need to deploy it in different networks.

Is there any solution to run a one time script after reboot which asks some questions about network configuration and to make this change?


You can put your script in an executable file, which, when run, as the last thing, makes itself non-executable. You may call it from /etc/rc.local, checking, before running it, whether the file is executable. If it is, fine, just run it, otherwise don't.

In your /etc/rc.local, include a statement like

 if [ -x /home/myname/bin/myscript.sh ]; then /home/myname/bin/myscript.sh; fi

Then put your commands in the file /home/myname/bin/myscript.sh, allowing it to begin as:



and put, as the last line to be executed:


Make the file executable (chmod 755 myscript.sh).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.