首页 > 系统服务 > 详细

linux常用命令:systemctl 命令

时间:2018-05-09 10:38:41      阅读:178      评论:0      收藏:0      [点我收藏+]

  systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起。

  技术分享图片

1.命令格式:

  systemctl [参数] [服务]

2.命令功能:

  systemd 是 Linux 下的一款系统和服务管理器,兼容 SysV 和 LSB 的启动脚本。

3.命令参数:

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

4.使用实例:

示例1:显示所有已经激活的服务

命令: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:显示所有已经安装的服务

命令: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:查看特定服务是否设定为开机自启

命令: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

 

 

5.其他:
ystemd 的特性有:

  • 支持并行化任务;
  • 同时采用 socket 式与 D-Bus 总线式激活服务;
  • 按需启动守护进程(daemon);
  • 利用 Linux 的 cgroups 监视进程;
  • 支持快照和系统恢复;
  • 维护挂载点和自动挂载点;
  • 各服务间基于依赖关系进行精密控制。

linux常用命令:systemctl 命令

原文:https://www.cnblogs.com/shujuxiong/p/9012745.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!