Well, as I collect threads I can link to, I will continue here..
Script is:
- as a first line. #! as 2 first characters make kernel read the rest of line (/bin/bash) and use it as an interpreter, that means, feed it with the file. You are using bash (if you don't know, you are), so it should be like that.
Then goes what you would type in shell, except that there are additional variables:
shows PATH variable in both shell and script, but
works only in script and shows first parameter to script (parameter is something on command line after command name).
But you don't need it. So you just paste
Code:
ifconfig eth0 xxx.xxx.xxx.xxx netmask <255.255.255.000/or something> up
route -n add default gw yyy.yyy.yyy.yyy
Now you save it (heh) and run
Code:
chmod a+x ip-address
It says to system, that the file is intended to be executed as a script (not only read as text).
Now you can run it as root:
Code:
[localhost /]# ./ip-address
and check it gives you network (do it after reboot).
is only simulation of root prompt (as opposed to ordinary user's). Don't retype it! (Well, more interesting for those who copy-paste - don't do it without reading)
Now go to /etc . You will find either /etc/rc.d/init.d or /etc/init.d .
Copy script to it. Go to init.d dir, then to ../rc3.d . With
Code:
ln -s ../init.d/ip-address S99_50ip-address
create a link for it (really, any S-starting symlink will do, but this will do it last command in init sequence).
Now do the same in ../rc5.d . Reboot. Doest it work?