Sunday 13 September 2020

Linux Service status checkings

To list all service


[root@rhel1 ~]# systemctl list-units --type=service

  UNIT                               LOAD   ACTIVE SUB     DESCRIPTION

  abrt-ccpp.service                  loaded active exited  Install ABRT coredump hook

  abrt-oops.service                  loaded active running ABRT kernel log watcher

  abrt-xorg.service                  loaded active running ABRT Xorg log watcher

  abrtd.service                      loaded active running ABRT Automated Bug Reporting Tool

  atd.service                        loaded active running Job spooling too

  

  

To list all Failed service


[root@rhel1 ~]# systemctl --failed

  UNIT           LOAD   ACTIVE SUB    DESCRIPTION

● kdump.service  loaded failed failed Crash recovery kernel arming

● mcelog.service loaded failed failed Machine Check Exception Logging Daemon


To list all Failed dependencies service


[root@rhel1 ~]# systemctl list-dependencies rsyslog

rsyslog.service

● ├─system.slice

● ├─basic.target

● │ ├─microcode.service

● │ ├─rhel-dmesg.service


to check active service


[root@rhel1 ~]# systemctl is-active rsyslog

unknown

[root@rhel1 ~]#

[root@rhel1 ~]#


to check enabled service


[root@rhel1 ~]# systemctl is-enabled rsyslog

disabled

[root@rhel1 ~]#

[root@rhel1 ~]#


to enable service


[root@rhel1 ~]# systemctl enable rsyslog

Created symlink from /etc/systemd/system/multi-user.target.wants/rsyslog.service to /usr/lib/systemd/system/rsyslog.service.

[root@rhel1 ~]#

[root@rhel1 ~]#


to check enable status of service


[root@rhel1 ~]# systemctl is-enabled rsyslog

enabled

[root@rhel1 ~]#

[root@rhel1 ~]#


to check active status of service


[root@rhel1 ~]# systemctl is-active rsyslog

inactive

[root@rhel1 ~]#

[root@rhel1 ~]#

[root@rhel1 ~]#


To start service


[root@rhel1 ~]# systemctl start  rsyslog

[root@rhel1 ~]#

[root@rhel1 ~]#

[root@rhel1 ~]# systemctl is-active rsyslog

active

[root@rhel1 ~]#

[root@rhel1 ~]#


to reload service


[root@rhel1 ~]# systemctl reload rsyslog

Failed to reload rsyslog.service: Job type reload is not applicable for unit rsyslog.service.

See system logs and 'systemctl status rsyslog.service' for details.

[root@rhel1 ~]#


to restart service


[root@rhel1 ~]# systemctl restart rsyslog

[root@rhel1 ~]#

[root@rhel1 ~]#

[root@rhel1 ~]# systemctl status rsyslog.service

● rsyslog.service - System Logging Service

   Loaded: loaded (/usr/lib/systemd/system/rsyslog.service; enabled; vendor preset: enabled)

   Active: active (running) since Sun 2020-09-13 20:44:35 IST; 13s ago

     Docs: man:rsyslogd(8)

           http://www.rsyslog.com/doc/

 Main PID: 67310 (rsyslogd)

   CGroup: /system.slice/rsyslog.service

           └─67310 /usr/sbin/rsyslogd -n


Sep 13 20:44:30 rhel1 systemd[1]: Stopped System Logging Service.

Sep 13 20:44:30 rhel1 systemd[1]: Starting System Logging Service...

Sep 13 20:44:35 rhel1 rsyslogd[67310]:  [origin software="rsyslogd" swVersion="8.24.0-38.el7" x-pid="67310" x-info="http://www.rsyslog.com"] start

Sep 13 20:44:35 rhel1 systemd[1]: Started System Logging Service.



to set default targets:


[root@rhel1 ~]# systemctl set-default rescue.target

Removed symlink /etc/systemd/system/default.target.

Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/rescue.target.

[root@rhel1 ~]#

[root@rhel1 ~]#

[root@rhel1 ~]# systemctl get-default

rescue.target

[root@rhel1 ~]#

[root@rhel1 ~]#

[root@rhel1 ~]# systemctl set-default poweroff.target

Removed symlink /etc/systemd/system/default.target.

Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/poweroff.target.

[root@rhel1 ~]#

[root@rhel1 ~]#

[root@rhel1 ~]# systemctl set-default multi-user.target

Removed symlink /etc/systemd/system/default.target.

Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.

[root@rhel1 ~]#

[root@rhel1 ~]# systemctl set-default network

network-online.target  network-pre.target     network.target

[root@rhel1 ~]# systemctl set-default network

network-online.target  network-pre.target     network.target

[root@rhel1 ~]# systemctl set-default network.target

Removed symlink /etc/systemd/system/default.target.

Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/network.target.

[root@rhel1 ~]#

[root@rhel1 ~]# systemctl set-default graphical.target

Removed symlink /etc/systemd/system/default.target.

Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.

[root@rhel1 ~]#

[root@rhel1 ~]#

[root@rhel1 ~]# systemctl set-default multi-user.target

Removed symlink /etc/systemd/system/default.target.

Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.

[root@rhel1 ~]#

[root@rhel1 ~]# systemctl get-default

multi-user.target

[root@rhel1 ~]#


No comments:

Post a Comment