systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起。
(1)用法:
用法: systemctl [参数] [服务]
(2)功能:
功能: systemd 是 Linux 下的一款系统和服务管理器,兼容 SysV 和 LSB 的启动脚本。
(3)选项参数:
start,stop,restart,status,enable,disable,is-enabled
(4)实例:
1)[[email protected] sunjimeng]# systemctl | more -5 显示所有已经激活的服务
[[email protected] sunjimeng]# systemctl | more -5 UNIT LOAD ACTIVE SUB DESCRIPTION proc-sys-fs-binfmt_misc.automount loaded active running Arbitrary Executable File Formats File System Automount Point sys-devices-pci0000:00-0000:00:07.1-ata2-host1-target1:0:0-1:0:0:0-block-sr0.device loaded active plugged --More-- [5]+ 已停止 systemctl | more -5 [[email protected] sunjimeng]# systemctl list-units |more -5 UNIT LOAD ACTIVE SUB DESCRIPTION proc-sys-fs-binfmt_misc.automount loaded active running Arbitrary Executable File Formats File System Automount Point sys-devices-pci0000:00-0000:00:07.1-ata2-host1-target1:0:0-1:0:0:0-block-sr0.device loaded active plugged --More--
2)[[email protected] sunjimeng]# systemctl list-unit-files |more -5 显示所有已经安装的服务
[[email protected] sunjimeng]# systemctl list-unit-files |more -5 UNIT FILE STATE proc-sys-fs-binfmt_misc.automount static dev-hugepages.mount static dev-mqueue.mount static proc-fs-nfsd.mount static --More--
3)[[email protected] sunjimeng]# systemctl is-enabled telnet.socket 查看特定服务是否设定为开机自启
[[email protected] sunjimeng]# systemctl is-enabled telnet.socket enabled [[email protected] sunjimeng]# chkconfig telnet.socket //这里不需要再加上.socket(加上之后没有反应) [[email protected] sunjimeng]# chkconfig telnet 注意:正在将请求转发到“systemctl is-enabled telnet.socket”。 enabled
(5)其他:
systemd 的特性有:
支持并行化任务; 同时采用 socket 式与 D-Bus 总线式激活服务; 按需启动守护进程(daemon); 利用 Linux 的 cgroups 监视进程; 支持快照和系统恢复; 维护挂载点和自动挂载点; 各服务间基于依赖关系进行精密控制。
时间: 2024-10-07 05:06:45