예를 들어 내가 실행할 때 :
systemctl status nut-monitor.service
systemd는 무엇을 합니까?
유닛 파일을 살펴봐도 단서를 찾을 수 없습니다.
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
~에서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.
기본적으로 systemctl status
서비스가 실행 중인지, 활성화되어 있는지 표시하고 systemd 로그의 마지막 10줄을 표시합니다.
journalctl --unit=servicename | tail -10
다음과 같은 작업을 수행하여 동일한 로그 출력을 얻을 수 있습니다.journalctl --unit=sshd | tail -10