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.