Ok, so you’re on your new CentOS 7 (or RHEL 7) system (we’ll just call it CentOS 7 for now to make it easier) and you restarted sshd with the old/familiar ‘service sshd restart’ command and you’re met with this: Redirecting to /bin/systemctl restart sshd.service
Код: Выделить всё
[root@centos7 ~]# service sshd restart
Redirecting to /bin/systemctl restart sshd.service
Код: Выделить всё
[root@centos7 ~]# service sshd restart
Redirecting to /bin/systemctl restart sshd.service
Now, it still restarted it, but that little note is annoying. It’s basically telling you “hey – things have changed… use systemctl now!”
You could now type ‘systemctl restart sshd’ for a shorter version.. here are some examples:
Stop service:
Код: Выделить всё
systemctl stop httpd
systemctl stop httpd
Start service:
systemctl start httpd
systemctl start httpd
Restart service (stops/starts):
Код: Выделить всё
systemctl restart httpd
systemctl restart httpd
Reload service (reloads config file):
Код: Выделить всё
systemctl reload httpd
systemctl reload httpd
List status of service:
Код: Выделить всё
systemctl status httpd
systemctl status httpd
What about chkconfig? That changed too? Yes, now you want to use systemctl for the chkconfig commands also..
chkconfig service on:
Код: Выделить всё
systemctl enable httpd
systemctl enable httpd
chkconfig service off:
Код: Выделить всё
systemctl disable httpd
systemctl disable httpd
chkconfig service (is it set up to start?)
Код: Выделить всё
systemctl is-enabled httpd
systemctl is-enabled httpd
chkconfig –list (shows what is and isn’t enabled)
Код: Выделить всё
systemctl list-unit-files --type=service
systemctl list-unit-files --type=service