So basically I needed to run a few commands at system start for a few of my debian vm’s who felt it would be a go idea to not start the system with my networking enabled @ run level 2…
I want to just be able to start the vm, wait for it to boot, and login via ssh remotely.

So…

1. Make your bash script. Here’s mine:

#!/bin/bash ifconfig eth0 up dhclient -nw eth0

2. Place it in /etc/init.d and name it anything you want (mine is named establish.sh) THEN chmod 755 establish.sh
3. Go into the /etc/rc2.d/ and make a symlink to the file…

ln -s ../init.d/establish.sh S99establish

Here we are telling it start (hence the S) and giving it a generic start number (I believe it’s just a priority) and then just name it establish.
4. Reboot and your system should automatically run the script while it starts and jumps into run level 2

Thats it!..This will work with any bash script you want to run at startup.

Blog Logo

Mario Loria


Published

Image

./scriptthe.net

Because 127.0.0.1 gets old after a while.

Back to Overview