服务命令在 centos 7 中不起作用

rob*_*895 7 linux centos systemd sysvinit

我曾经service在centos 6.5上使用命令重新启动,重新加载和检查服务状态,如下所示:

$ sudo service nginx restart OK
$ sudo service nginx status OK

但是,在 CentOS 7 中,我因做同样的事情而收到此通知。

[root@admin ~]# service nginx restart
Redirecting to /bin/systemctl restart  nginx.service
[root@admin ~]# 
Run Code Online (Sandbox Code Playgroud)

问: Centos7.5如何启动nginx服务?

Sep*_*our 7

service命令在 CentOS 7 中不再起作用。基于 Redhat 的操作系统从 SysVinit 系统迁移到 Systemd。

你必须使用 systemctl start nginx.service

对于 sysVinit 到 systemd 备忘单,请访问以下链接:https ://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet