Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question
    
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. –  jw013 May 9 '12 at 12:06
add comment

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer
add comment

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|improve this answer
add comment

Another easy method to perform the network restart is to create the following bash file, called in my case [net] ie: /etc/init.d/net

The script:

#!/bin/sh -e
invoke-rc.d networking stop ;  invoke-rc.d networking start ; ifup eth0 

#Add whatever interfaces you have installed. ie: ifup eth0 wlan0 etc 

After creation chmod 711 'the filename' [net]

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.