linux 服务状态命令,Linux 查看服务列表,查看服务状态
使用service查看命令說明
ubuntu@VM-0-17-ubuntu:/$?service
Usage:?service??|?--status-all?|?[?service_name?[?command?|?--full-restart?]?]
ubuntu@VM-0-17-ubuntu:/$
1. 查看系統服務列表 ? service –status -all ? 注意,status 前面是兩個橫線 -- ? ? all前面是一個橫線 -
由于太長截圖列出一部分服務,從圖中看到,服務名稱前面有 + - 號,
+服務啟動
- 服務未啟動
2. 查看單個服務啟動狀態? service servicename status ?? 注意,status 前面沒有橫線
舉例,查看atd的服務狀態,返回狀態信息如下ubuntu@VM-0-17-ubuntu:/$?service?atd?status
●?atd.service?-?Deferred?execution?scheduler
Loaded:?loaded?(/lib/systemd/system/atd.service;?enabled;?vendor?preset:?enabled)
Active:?active?(running)?since?Tue?2019-10-15?09:16:18?CST;?3?weeks?1?days?ago
Docs:?man:atd(8)
Main?PID:?1051?(atd)
Tasks:?1?(limit:?4465)
CGroup:?/system.slice/atd.service
└─1051?/usr/sbin/atd?-f
舉例,查看acpid(未開啟)的服務狀態ubuntu@VM-0-17-ubuntu:/$?service?acpid?status
●?acpid.service?-?ACPI?event?daemon
Loaded:?loaded?(/lib/systemd/system/acpid.service;?disabled;?vendor?preset:?enabled)
Active:?inactive?(dead)
3.啟動服務? service servicename start ? ,使用acpid 服務舉例root@VM-0-17-ubuntu:/#?service?acpid?start
啟動后,使用 service acpid status 查看服務狀態root@VM-0-17-ubuntu:/#?service?acpid?start
root@VM-0-17-ubuntu:/#?service?acpid?status
●?acpid.service?-?ACPI?event?daemon
Loaded:?loaded?(/lib/systemd/system/acpid.service;?disabled;?vendor?preset:?enabled)
Active:?active?(running)?since?Wed?2019-11-06?10:12:58?CST;?12s?ago
Main?PID:?23365?(acpid)
Tasks:?1?(limit:?4465)
CGroup:?/system.slice/acpid.service
└─23365?/usr/sbin/acpid
4.停止服務 service servicename stop? ,使用acpid服務舉例root@VM-0-17-ubuntu:/#?service?acpid?stop
Warning:?Stopping?acpid.service,?but?it?can?still?be?activated?by:
acpid.path
root@VM-0-17-ubuntu:/#?service?acpid?status
●?acpid.service?-?ACPI?event?daemon
Loaded:?loaded?(/lib/systemd/system/acpid.service;?disabled;?vendor?preset:?enabled)
Active:?inactive?(dead)?since?Wed?2019-11-06?10:18:44?CST;?19s?ago
Process:?23365?ExecStart=/usr/sbin/acpid?$OPTIONS?(code=exited,?status=0/SUCCESS)
Main?PID:?23365?(code=exited,?status=0/SUCCESS)
Nov?06?10:12:58?VM-0-17-ubuntu?systemd[1]:?Started?ACPI?event?daemon.
Nov?06?10:12:58?VM-0-17-ubuntu?acpid[23365]:?starting?up?with?netlink?and?the?input?layer
Nov?06?10:12:58?VM-0-17-ubuntu?acpid[23365]:?0?rules?loaded
Nov?06?10:12:58?VM-0-17-ubuntu?acpid[23365]:?waiting?for?events:?event?logging?is?off
Nov?06?10:18:44?VM-0-17-ubuntu?systemd[1]:?Stopping?ACPI?event?daemon...
Nov?06?10:18:44?VM-0-17-ubuntu?systemd[1]:?Stopped?ACPI?event?daemon.
5.重啟服務? service servicename restart
重啟就不舉例了,效果自己腦補吧
總結
以上是生活随笔為你收集整理的linux 服务状态命令,Linux 查看服务列表,查看服务状态的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python爬虫入门四urllib库的高
- 下一篇: linux下邮件查看命令