service command does not work in centos 7

38,610

service command doesn't work in CentOS 7 any more. Redhat based OS migrated to Systemd from SysVinit system.

You have to use systemctl start nginx.service

For sysVinit to systemd cheatsheet visit following link: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet

Share:
38,610
robue-a7119895
Author by

robue-a7119895

a7119895

Updated on September 18, 2022

Comments

  • robue-a7119895
    robue-a7119895 over 1 year

    I used to use service command for restarting, reloading, and checking status of service on centos 6.5 like below:

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

    But, in CentOS 7 I get this notice for doing the same thing.

    [root@admin ~]# service nginx restart
    Redirecting to /bin/systemctl restart  nginx.service
    [root@admin ~]# 
    

    Question: How do I start nginx service in Centos7.5?

  • robue-a7119895
    robue-a7119895 over 9 years
    Weird. It does work with just systemctl start nginx but it never shows the status, or OK message.