Running commands on startup?


#1

What is the best way to have configuration commands run at startup. Basically, I want to have a script figure out what the IP address is of a certain interface, then set that IP as the local-host on an openvpn interface.

Im using this to put the IP into a variable - IP=$(sudo ifconfig eth2 | grep ‘inet addr:’| grep -v ‘127.0.0.1’ | cut -d: -f2 | awk ‘{ print $1}’)

But i can’t seem to find a way to run the command “set interfaces openvpn vtun1 local-host $IP” automatically at startup.