09、列出所有失败的单元
# systemctl --failedUNITLOADACTIVE SUBDESCRIPTIONkdump.service loaded failed failed Crash recovery kernel armingLOAD= Reflects whether the unit definition was properly loaded.ACTIVE = The high-level unit activation state, i.e. generalization of SUB.SUB= The low-level unit activation state, values depend on unit type.1 loaded units listed. Pass --all to see loaded but inactive units, too.To show all installed unit files use 'systemctl list-unit-files'.10、检查单元(cron.service)是否启用?
# systemctl is-enabled crond.serviceenabled11.检查单元或服务是否正在运行?
systemctl status firewalld.servicefirewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)Active: active (running) since Tue 2018-04-28 16:27:55 IST; 34min agoMain PID: 549 (firewalld)CGroup: /system.slice/firewalld.service└─549 /usr/bin/Python/ target=_blank class=infotextkey>Python -Es /usr/sbin/firewalld --nofork --nopidApr 28 16:27:51 tecmint systemd[1]: Starting firewalld - dynamic firewall daemon...Apr 28 16:27:55 tecmint systemd[1]: Started firewalld - dynamic firewall daemon.12.列出所有服务(包括启用和禁用)
# systemctl list-unit-files --type=serviceUNIT FILESTATEarp-ethers.servicedisabledauditd.serviceenabled autovt@.servicedisabledblk-availability.servicedisabledbrandbot.servicestaticcollectd.servicedisabledconsole-getty.servicedisabledconsole-shell.servicedisabledcpupower.servicedisabledcrond.serviceenabled dbus-org.fedoraproject.FirewallD1.serviceenabled ....13.如何在Linux中启动 , 重新启动 , 停止 , 重新加载和检查服务(httpd.service)的状态
# systemctl start httpd.service# systemctl restart httpd.service# systemctl stop httpd.service# systemctl reload httpd.service# systemctl status httpd.servicehttpd.service - The Apache HTTP ServerLoaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)Active: active (running) since Tue 2018-04-28 17:21:30 IST; 6s agoProcess: 2876 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)Main PID: 2881 (httpd)Status: "Processing requests..."CGroup: /system.slice/httpd.service├─2881 /usr/sbin/httpd -DFOREGROUND├─2884 /usr/sbin/httpd -DFOREGROUND├─2885 /usr/sbin/httpd -DFOREGROUND├─2886 /usr/sbin/httpd -DFOREGROUND├─2887 /usr/sbin/httpd -DFOREGROUND└─2888 /usr/sbin/httpd -DFOREGROUNDApr 28 17:21:30 tecmint systemd[1]: Starting The Apache HTTP Server...Apr 28 17:21:30 tecmint httpd[2881]: AH00558: httpd: Could not reliably determine the server's fully q...ssageApr 28 17:21:30 tecmint systemd[1]: Started The Apache HTTP Server.Hint: Some lines were ellipsized, use -l to show in full.
注意:当我们使用systemctl等启动 , 重启 , 停止和重载等命令时 , 我们将不会在终端上获得任何输出 , 只有status命令会打印输出 。14.如何在引导时激活服务并启用或禁用服务(系统引导时自动启动服务)
# systemctl is-active httpd.service# systemctl enable httpd.service# systemctl disable httpd.service15.如何屏蔽(使其无法启动)或取消屏蔽服务(httpd.service)ln -s '/dev/null' '/etc/systemd/system/httpd.service'# systemctl unmask httpd.servicerm '/etc/systemd/system/httpd.service'16.如何使用systemctl命令终止服务# systemctl kill httpd# systemctl status httpdhttpd.service - The Apache HTTP ServerLoaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)Active: failed (Result: exit-code) since Tue 2018-04-28 18:01:42 IST; 28min agoMain PID: 2881 (code=exited, status=0/SUCCESS)Status: "Total requests: 0; Current requests/sec: 0; Current traffic:0 B/sec"Apr 28 17:37:29 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled.Apr 28 17:37:29 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled.Apr 28 17:37:39 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled.Apr 28 17:37:39 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled.Apr 28 17:37:49 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled.Apr 28 17:37:49 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled.Apr 28 17:37:59 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled.Apr 28 17:37:59 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled.Apr 28 18:01:42 tecmint systemd[1]: httpd.service: control process exited, code=exited status=226Apr 28 18:01:42 tecmint systemd[1]: Unit httpd.service entered failed state.Hint: Some lines were ellipsized, use -l to show in full.
推荐阅读
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 电动三轮车全车接线图详解 手工版
- 详解立春的起源与含义
- 解决'不是内部或外部命令,也不是可运行的程序
- 淘宝买家申请退货退款操作流程详解
- 热血传奇手游法师技能,热血传奇法师技能详解-
- 保险销售技巧和话术详解
- 去医院看病的流程详解
- 英国巴斯大学本科学费和申请要求详解
- cad中光标旁的命令输入框不见了
- autocad自带的修复命令
