如何查看rc.local服务
时间: 2024-05-16 19:19:08 浏览: 132
要查看 `rc.local` 服务的状态,你可以使用以下命令:
```
systemctl status rc-local
```
这将显示 `rc.local` 服务的当前状态,包括是否正在运行以及相关的详细信息。如果服务正在运行,你将看到类似以下的输出:
```
● rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
Active: active (exited) since Mon 2021-09-27 10:30:00 UTC; 1 day 5h ago
Process: 568 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 4708)
Memory: 0B
CGroup: /system.slice/rc-local.service
Sep 27 10:30:00 example-server systemd[1]: Starting /etc/rc.local Compatibility...
Sep 27 10:30:00 example-server rc.local[568]: Starting rc.local...
Sep 27 10:30:00 example-server rc.local[568]: Hello, world!
Sep 27 10:30:00 example-server systemd[1]: Started /etc/rc.local Compatibility.
```
如果服务没有运行,你将看到类似以下的输出:
```
● rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
Active: inactive (dead)
```
这意味着 `rc.local` 服务当前处于停止状态。
阅读全文