sudo /etc/init.d/apache2 restart


sudo service apache2 restart

What are the differences?



service calls scripts located in /etc/init.d, so there are no differences in the result in this case.

From the man service:

service runs a System V init script or upstart job in as predictable environment as possible, removing most environment variables and with current working directory set to /.

The  SCRIPT  parameter  specifies  a  System  V init script, located in /etc/init.d/SCRIPT, or the name of an upstart job in /etc/init.
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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