重新启动 apache2 和服务 apache2 有什么区别?

重新启动 apache2 和服务 apache2 有什么区别?
sudo /etc/init.d/apache2 restart

sudo service apache2 restart

有什么区别?

谢谢

答案1

service调用位于的脚本/etc/init.d,因此在这种情况下结果没有差异。

来自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.

相关内容