![重新启动 apache2 和服务 apache2 有什么区别?](https://linux22.com/image/1116270/%E9%87%8D%E6%96%B0%E5%90%AF%E5%8A%A8%20apache2%20%E5%92%8C%E6%9C%8D%E5%8A%A1%20apache2%20%E6%9C%89%E4%BB%80%E4%B9%88%E5%8C%BA%E5%88%AB%EF%BC%9F.png)
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.