systemd是systemdeamon,是Linux下的init软件。大部分开源Linux发行版都支持,包括redhat、ubuntu、centos等。systemd是一组命令,其中最重要的是systemctl命令1.systemctl主命令1.1常用命令systemctl是主命令系统,用于管理系统和服务;mansystemctl查看systemctl的帮助文档systemctlrebootrestartsystemctlpoweroffclose系统,切断电源systemctlhaltCPU停止工作service关闭httpd下的所有子进程servicesystemctlenablehttpd.servicestart启动httpdsystemctldisablehttpd.service禁止在启动时启动httpd修改一个服务配置文件systemctldaemon-reload重新加载配置systemctlrestarthttpd.service重启生效1.2单元认知单元概念:systemd可以管理所有的系统资源。不同的资源统称为unitunit,分为12种servicesystemservicetarget由多个unit组成的一组devicehardwaredevicemountfilesystemmountpointautomount自动挂载点pathfileorpathscope不是systemd进程slice进程启动的groupsnapshotsnapshotsocket进程间通信socketswapswapfiletimertimerunit相关命令systemctllist-units列出运行单元systemctllist-units--type=service列出service类型的所有运行单元,包没有找到配置文件或启动失败systemd-analyze检查启动时间3。hostnamectl查看并设置主机信息hostnamectlset-hostname[newhostname]设置主机名4.localectl检查和设置本地化信息5。timedatectlcheckandsetthecurrenttimezone6.loginctl查看当前登录的用户
