ubuntu:systemd:check_the_status_of_a_specific_service
Ubuntu - SystemD - Manage Services - Check the status of a specific service
Check the status of a specific service, for example, SSH daemon.
systemctl status cron
returns:
● cron.service - Regular background program processing daemon Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2023-06-03 08:31:48 BST; 1h 27min ago Docs: man:cron(8) Main PID: 1200 (cron) Tasks: 1 (limit: 76976) Memory: 468.0K CPU: 15ms CGroup: /system.slice/cron.service └─1200 /usr/sbin/cron -f -P Jun 03 08:31:48 BigMamba systemd[1]: Started Regular background program processing daemon. Jun 03 08:31:48 BigMamba cron[1200]: (CRON) INFO (pidfile fd = 3) Jun 03 08:31:48 BigMamba cron[1200]: (CRON) INFO (Running @reboot jobs) Jun 03 09:17:01 BigMamba CRON[8424]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0) Jun 03 09:17:01 BigMamba CRON[8425]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly) Jun 03 09:17:01 BigMamba CRON[8424]: pam_unix(cron:session): session closed for user root Jun 03 09:30:01 BigMamba CRON[9087]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0) Jun 03 09:30:01 BigMamba CRON[9088]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi) Jun 03 09:30:01 BigMamba CRON[9087]: pam_unix(cron:session): session closed for user root
If the Service is not running
systemctl status ssh
returns:
Unit ssh.service could not be found.
ubuntu/systemd/check_the_status_of_a_specific_service.txt · Last modified: 2023/06/03 09:01 by peter