2

When I run eg:

systemctl status nut-monitor.service

what does systemd do?

If I take a look to unit file I don't find any clue:

 cat /usr/lib/systemd/system/nut-monitor.service
[Unit]
Description=Network UPS Tools - power device monitor and shutdown controller
After=local-fs.target network.target nut-server.service

[Service]
ExecStartPre=-/usr/bin/systemd-tmpfiles --create /etc/tmpfiles.d/nut-run.conf
ExecStart=/usr/sbin/upsmon -F
Type=simple

[Install]
WantedBy=multi-user.target
1

1 Answer 1

3

From man systemctl

Show terse runtime status information about one or more units, followed by most recent log data from the journal.
           If no units are specified, show system status. If combined with --all, also show the status of all units (subject
           to limitations specified with -t). If a PID is passed, show information about the unit the process belongs to.

           This function is intended to generate human-readable output. If you are looking for computer-parsable output, use
           show instead. By default this function only shows 10 lines of output and ellipsizes lines to fit in the terminal
           window. This can be changes with --lines and --full, see above. In addition, journalctl --unit=NAME use a similar
           filter for messages and might be more convenient.

Basically systemctl status will show if the service is running, if it is enabled, and it will show last 10 lines from systemd logs.

You can get the same log output by doing journalctl --unit=servicename | tail -10 like for example journalctl --unit=sshd | tail -10

Not the answer you're looking for? Browse other questions tagged .