Difference between /etc/init.d/networking restart and invoke-rc.d networking restart

9,271

Solution 1

What invoke-rc.d does is documented in its man page. It is a wrapper around running the init script directly, but it also applies a policy that may cause the command not to be run, based on the current runlevel and whether the daemon should be run in that runlevel.

By default, Debian does not differentiate between runlevels 2-5, but as the local administrator, you can change what is run in each runlevel. invoke-rc.d will honor these local policies and not start a daemon if the runlevel is wrong.

Solution 2

There is no real difference[1]. The invoke-rc.d command simply provides a nice convenient interface for running the init.d scripts, sparing you the onerous responsibility of typing in the full path to the script you want to run! Both invocations will achieve the same end result.

[1] Note that the invoke-rc.d command performs checks before invoking the requested service script to ensure it should be run - it guards against calling scripts in the wrong runlevel, etc, so in that sense, there is a difference - it protects you from shooting your feet somewhat. The man page should prove instructive in this regard.

Share:
9,271

Related videos on Youtube

Lucas Kauffman
Author by

Lucas Kauffman

I'm a Belgian security consultant living in Singapore, I'm here to learn and help others out. Opinions are my own. Advice provided with no warranty. Find me on http://cloud101.eu Sometimes you can have a craving only hands can satisfy!

Updated on September 18, 2022

Comments

  • Lucas Kauffman
    Lucas Kauffman over 1 year

    Is there any real difference between /etc/init.d/networking restart and invoke-rc.d networking restart (Debian)?

    • jw013
      jw013 about 12 years
      There is also service networking restart. Unfortunately I don't know enough to give you a detailed comparison of the 3 methods, except that running the /etc/init.d/ script is more "low-level" than the others.