systemctlとstatusコマンドの機能は何ですか? [閉鎖]

systemctlとstatusコマンドの機能は何ですか? [閉鎖]

たとえば、私が実行したとき:

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

おすすめ記事