How do i check the status of a linux service?



  • Note: This is for newer versions of linux.

    To view status of all services. One way is:

    $ systemctl list-units --type=service
     UNIT                                LOAD   ACTIVE SUB     DESCRIPTION                         
    ...
    ...
    ...
    NetworkManager-wait-online.service  loaded active exited  Network Manager Wait Online         
    NetworkManager.service              loaded active running Network Manager                     
    packagekit.service                  loaded active running PackageKit Daemon
    ...
    ...
    ...
    

    This is also a good way of checking the service name. Service listed under the column UNIT

    For more detail run the following on a service.

    $ systemctl status chef-manage-runsvdir-start.service
    ● chef-manage-runsvdir-start.service - chef-manage Runit Process Supervisor
       Loaded: loaded (/etc/systemd/system/chef-manage-runsvdir-start.service; enabled; vendor preset
       Active: active (running) since Wed 2018-10-24 09:29:43 PDT; 2 weeks 6 days ago
     Main PID: 1090 (runsvdir)
        Tasks: 7 (limit: 4915)
       CGroup: /system.slice/chef-manage-runsvdir-start.service
               ├─1090 runsvdir -P /opt/chef-manage/service log: .....................................
               ├─1152 runsv redis
               ├─1153 runsv web
               ├─1154 runsv worker
               ├─1230 /opt/chef-manage/embedded/bin/svlogd -tt /var/log/chef-manage/redis
               ├─1231 /opt/chef-manage/embedded/bin/svlogd -tt /var/log/chef-manage/web
               └─1251 /opt/chef-manage/embedded/bin/svlogd -tt /var/log/chef-manage/worker
    
    Oct 24 09:29:43 training-vm systemd[1]: Started chef-manage Runit Process Supervisor.
    

 

© Lightnetics 2018