9

On RHEL 7 or CentOS 7, the systemctl or systemd command works fine. I know it won't work in RHEL 6 or CentOS 6. Can you tell me the alternative command for starting/stopping a service, for example: systemctl start iptables.service?

16

In earlier versions of RHEL use the service command as explained in the documentation here.

# service service_name start

Therefore, in your case:

# service iptables start

You can replace start with restart, stop, status.

List all services with:

# service --status-all
  • 1
    Note: there still is a compatibility script service in RHEL7, which can actually do more than systemctl does, so for the moment, it's a safer bet on all supported versions. – Ulrich Schwarz Nov 29 '17 at 7:03
0

rhel 6 and centos 6 are using upstart, not systemd. SysV (service and chkconfig) is also still supported.

Check documentation of initctl and files in /etc/init/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.