3

What is the difference between service apache2 reload and sudo systemctl restart apache2?

I understand that one uses sudo and others don't. Also, I can understand the difference between reloading and restart. But what is the major difference between these two commands?

RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93
sofs1
  • 3,834
  • 11
  • 51
  • 89
  • Again, That question is about difference between "systemctl restart" and "systemctl start", whereas mine is about 'service apache2 reload' vs 'sudo systemctl restart apache2' ? People who don't know the answer, it is a completely different question. – sofs1 Aug 11 '19 at 02:09

2 Answers2

6

Restart = stop + start
Reload = remain running + re-read configuration files

  • 1
    But in one command we use service and another command we use systemctl. Why is that so? What is the difference? – sofs1 Aug 11 '19 at 04:40
2

We could define it like this:

Restart--> STOP the service and then it will START the service.

Now comes Reload option.

Reload--> Read .service file for which you have executed the command and if any changes happened it will start using those changes now, so each time a change happens in any service file a reload is needed. You could even see this message coming, lets say you have changed a service and you forgot to reload it so whenever you run any systemctl command towards that service it will throw an error to reload it.

RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93