您的位置:首页 > 运维架构 > Linux

每天一个Linux命令(55)systemctl命令

2016-06-22 08:11 1086 查看
systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起。



[b] (1)用法:[/b]

[b] 用法: systemctl [参数] [服务][/b]

[b] (2)功能:[/b]

[b] 功能: systemd 是 Linux 下的一款系统和服务管理器,兼容 SysV 和 LSB 的启动脚本。[/b]

[b] (3)选项参数:[/b]

start,stop,restart,status,enable,disable,is-enabled

[b] (4)实例:[/b]

1)[root@localhost sunjimeng]# systemctl | more -5         显示所有已经激活的服务

[root@localhost 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
[root@localhost 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)[root@localhost sunjimeng]# systemctl list-unit-files |more -5   显示所有已经安装的服务

[root@localhost 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)[root@localhost sunjimeng]# systemctl is-enabled telnet.socket   查看特定服务是否设定为开机自启 

[root@localhost sunjimeng]# systemctl is-enabled telnet.socket
enabled
[root@localhost sunjimeng]# chkconfig telnet.socket        //这里不需要再加上.socket(加上之后没有反应)
[root@localhost sunjimeng]# chkconfig telnet
注意:正在将请求转发到“systemctl is-enabled telnet.socket”。
enabled


[b] (5)其他:[/b]

systemd 的特性有:

支持并行化任务;
同时采用 socket 式与 D-Bus 总线式激活服务;
按需启动守护进程(daemon);
利用 Linux 的 cgroups 监视进程;
支持快照和系统恢复;
维护挂载点和自动挂载点;
各服务间基于依赖关系进行精密控制。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: