Results 1 to 4 of 4
I've made a simple script that creates a network tunnel when I run it (I find it silly that the kernel will forget any tunnel settings after a reboot, don't ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-24-2011 #1Just Joined!
- Join Date
- Oct 2009
- Posts
- 59
How does Linux load init.d scripts?
I've made a simple script that creates a network tunnel when I run it (I find it silly that the kernel will forget any tunnel settings after a reboot, don't know why it is like that).
If I simply copy the script to the init.d directory, will it auto run after each boot and simply work (as it always works when using `sh tunnelscript`) or do I need to change it?
- 09-24-2011 #2
Most distros use the System V startup in which each run level is represented by a directory with a name like rc2.d, rc3.d, etc. These contain links (shortcuts) to the scripts in init.d. So if you wanted to put your script in init.d, you would have to put a link to it into the directory corresponding to your default run level.
But it's much simpler to edit this kind of thing into the rc.local script, which runs at the end of the startup process. You'll probably find this script either in /etc or in /etc/rc.d."I'm just a little old lady; don't try to dazzle me with jargon!"
- 09-24-2011 #3Just Joined!
- Join Date
- Oct 2009
- Posts
- 59
Thanks.
And what happens if I remove a script from init.d - the links will obviously fail, but will it be a problem during boot or will it just skip on errors.
I've disabled postfix and dovecot by moving their init scripts to another directory, but I don't know what will happen after a reboot.
- 09-25-2011 #4
Don't remove the script. As you rightly point out, that causes trouble all round. As long as the relevant program remains installed on your computer, the init.d script should remain in place. Only edit the links. You can delete links, but they are often replaced during updates, so it is better to replace an S-link with a K-link. So if you have a link S75postfix, replace it by K25postfix.
"I'm just a little old lady; don't try to dazzle me with jargon!"


Reply With Quote

