I want to add a permanent iptables
rule to my new VPS
, and after brief google search i was surprised that there are two places this rule can be added, that seems like identical: /etc/rc.local
and /etc/init.d/rc.local
. Maybe someone knows why where is two places for simple startup code to place? Is it linux flavor specific (but ubuntu has both!)? Or one of them is deprecated?
Difference Between /etc/rc.local and /etc/init.d/rc.local – Explained
configurationstartup
Best Answer
/etc/init.d
is maintained on ubuntu for backward compatibility with sysvinit stuff. If you actually look at/etc/init.d/rc.local
you'll see (also from a 12.04 LTS Server):And "Run /etc/rc.local" is exactly what it does. The entirety of
/etc/rc.local
is:I would guess the purpose in doing this is to provide a dead simple place to put shell commands you want run at boot, without having to deal with the stop|start service stuff, which is in
/etc/init.d/rc.local
.So it is in fact a service, and can be run as such. I added a
echo
line to/etc/rc.local
and:However, I do not believe it is referenced by anything in upstart's
/etc/init
(not init.d!) directory:There are a few "rc" services in upstart:
But none of those seem to have anything to do with rc.local.