Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
和有什么区别
service apache2 restart
和
/etc/init.d/apache2 restart
那么基本上为什么推荐服务命令而不是直接调用适当的命令呢?
该service命令在可预测的环境中运行初始化脚本:
service
服务在尽可能可预测的环境中运行 System V 初始化脚本,删除大多数环境变量并将当前工作目录设置为 /。
来自: http: //linux.die.net/man/8/service