linux systemctl 查看服务的状态、runlevel和target的对应关系

举报
千江有水千江月 发表于 2021/09/30 16:31:24 2021/09/30
【摘要】 ECS信息规格:2vCPUs | 4GiB | kc1.large.2镜像:openEuler 20.03 64bit with ARM | 公共镜像  linux systemctl 查看服务的状态、runlevel和target的对应关系 systemctl status 查看服务的状态IP地址已做隐藏处理# systemctl status sshd.service● sshd.se...

ECS信息

  • 规格:2vCPUs | 4GiB | kc1.large.2
  • 镜像:openEuler 20.03 64bit with ARM | 公共镜像

linux systemctl 查看服务的状态、runlevel和target的对应关系

systemctl status 查看服务的状态

IP地址已做隐藏处理

# systemctl status sshd.service
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2021-09-26 16:48:16 CST; 5h 34min ago
     Docs: man:sshd(8)
           man:sshd_config(5)
 Main PID: 1902 (sshd)
    Tasks: 1
   Memory: 24.2M
   CGroup: /system.slice/sshd.service
           └─1902 /usr/sbin/sshd -D

Sep 26 21:39:42 ecs-4eee sshd[3571]: rexec line 153: Deprecated option RSAAuthentication
Sep 26 21:39:42 ecs-4eee sshd[3571]: rexec line 155: Deprecated option RhostsRSAAuthentication
Sep 26 21:49:18 ecs-4eee sshd[3699]: rexec line 153: Deprecated option RSAAuthentication
Sep 26 21:49:18 ecs-4eee sshd[3699]: rexec line 155: Deprecated option RhostsRSAAuthentication
Sep 26 22:00:53 ecs-4eee sshd[3924]: rexec line 153: Deprecated option RSAAuthentication
Sep 26 22:00:53 ecs-4eee sshd[3924]: rexec line 155: Deprecated option RhostsRSAAuthentication
Sep 26 22:00:53 ecs-4eee sshd[3924]: Connection from XXX.XXX.XXX.XXX port 50408 on XXX.XXX.XXX.XXX port 22 rdom
Sep 26 22:00:53 ecs-4eee sshd[3924]: Connection reset by XXX.XXX.XXX.XXX port 50408 [preauth]
Sep 26 22:11:52 ecs-4eee sshd[4044]: rexec line 153: Deprecated option RSAAuthentication
Sep 26 22:11:52 ecs-4eee sshd[4044]: rexec line 155: Deprecated option RhostsRSAAuthentication

systemctl is-enabled 查看服务是否为开机启动

# systemctl is-enabled sshd.service
enabled

systemd runlevel和target 的对应关系

# pwd
/lib/systemd/system
# ll | grep runlevel
lrwxrwxrwx. 1 root root   15 Mar 24  2020 runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root   13 Mar 24  2020 runlevel1.target -> rescue.target
drwxr-xr-x. 2 root root 4.0K Mar 24  2020 runlevel1.target.wants
lrwxrwxrwx. 1 root root   17 Mar 24  2020 runlevel2.target -> multi-user.target
drwxr-xr-x. 2 root root 4.0K Mar 24  2020 runlevel2.target.wants
lrwxrwxrwx. 1 root root   17 Mar 24  2020 runlevel3.target -> multi-user.target
drwxr-xr-x. 2 root root 4.0K Mar 24  2020 runlevel3.target.wants
lrwxrwxrwx. 1 root root   17 Mar 24  2020 runlevel4.target -> multi-user.target
drwxr-xr-x. 2 root root 4.0K Mar 24  2020 runlevel4.target.wants
lrwxrwxrwx. 1 root root   16 Mar 24  2020 runlevel5.target -> graphical.target
drwxr-xr-x. 2 root root 4.0K Mar 24  2020 runlevel5.target.wants
lrwxrwxrwx. 1 root root   13 Mar 24  2020 runlevel6.target -> reboot.target
-rw-r--r--. 1 root root  801 Mar 24  2020 systemd-update-utmp-runlevel.service

runlevel target
runlevel0.target poweroff.target
runlevel1.target rescue.target
runlevel2.target multi-user.target
runlevel3.target multi-user.target
runlevel4.target multi-user.target
runlevel5.target graphical.target
runlevel6.target reboot.target

帮助文档(部分)

# systemctl -h
systemctl [OPTIONS...] {COMMAND} ...

Query or send control commands to the systemd manager.

  -h --help           Show this help
     --version        Show package version
     --system         Connect to system manager
     --user           Connect to user service manager
  -H --host=[USER@]HOST
                      Operate on remote host

......

学习资料

欢迎各位同学一起来交流学习心得^_^

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。