What's the difference between them and which cases to use?
service apache2 restart
and service apache2 reload
What's the difference between them and which cases to use?
service apache2 restart
and service apache2 reload
reload
tells the service to reload its configuration files. This means that it should be enough to reload the configuration.However, there may be certain services that do not follow this rule, or that will not reload configuration files.
I removed the snippet above from here .
As a complement, I believe that reload
works for cases such as adding new sites (via Virtualhost) to Apache. %% Will cause the settings to be "reloaded", causing the new site added to be recognized.
On the other hand, when you activate / deactivate an extension for example, it is restart the server.
Roughly, summarize as follows:
The reload
stops and starts the server again. restart
only reloads the settings. This sounds like the difference between restarting the computer and just logging out and logging in again.
See that there is a difference between one and another in the speed of execution: reload
is always executed faster than reload
, since the operation of this is simpler.
In this last example, restart
is useful to avoid a momentary loss of connection between your server and the client that is currently doing some operation on your system, since the speed at which reload
is executed is almost imperceptible, while reload
takes a little longer.