问题原文
原帖链接 · munich · CC BY-SA 3.0
I just installed CentOS 7.1 on one server and I'm confused by how systemctl works compared to service.
On CentOS 6, I would get feedback when running service, such as:
root@centos6 [~]# service mysql restart
Shutting down MySQL........................................[ OK ]
Starting MySQL.............................................[ OK ]
root@centos6 [~]# service mysql status
MySQL running (910285) [ OK ]
root@centos6 [~]#
However on CentOS 7, when I use systemctl, I get nothing. I don't know what happened, or if something even happened:
root@centos7 [~]# systemctl restart mysql
root@centos7 [~]# /bin/systemctl restart mysql.service
# Nothing happened
And when I run service on CentOS 7, this happens:
root@centos7 [~]# service mysql restart
Redirecting to /bin/systemctl restart mysql.service
What am I'm missing?
社区高分解答
原帖链接 · rutger · CC BY-SA 3.0
Here is what I do:
systemctl start my-service && journalctl -fexu my-service
journalctl is the simplest way to get output from your systemd services.
-ffollows the log output ofmy-serviceuntil I quit (ctrl-C).-escrolls to the end (most recent) log messages.-xexplanations from the Journal Message Catalog, if available.
(See also https://www.freedesktop.org/wiki/Software/systemd/catalog/)-uwill only show logs from themy-serviceunit.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
