systemdが認識するtimerの次回・前回実行時刻と対応unitを、状態変更せず一覧表示する。
適切なコマンドはどれか。
systemctl list-timersはtimerの次回・前回発火、timer unit、起動対象を一覧できる。
詳細解説
systemctl list-units --type=serviceservice unitの状態一覧で、timerの予定列を中心に表示しない。
誤り。service typeのlist-unitsはservice状態を見る用途で、timerのNEXTやACTIVATESを中心とした予定一覧ではない。
systemctl list-timerstimer unitのNEXT、LAST、UNIT、ACTIVATES等を一覧表示する。
正しい。systemctl list-timersはtimerごとの次回・前回時刻、timer unit、起動対象unitを読取表示する。
systemctl show-calendarsystemctlにtimer一覧用のshow-calendar subcommandはない。
誤り。show-calendarというsystemctl subcommandはなく、calendar式の解析はsystemd-analyze calendarを使う。
crontab -lユーザーcrontabを表示し、systemd timer unitは対象外である。
誤り。crontab -lはcron daemon向けのユーザー登録だけを読み、systemdの.timer unitを一覧しない。
実際に確かめる
一時的な検証環境で実行できる例です。
systemctl list-timers --no-pager --no-legend 2>&1 | head -n 3期待される結果
timerがある環境ではNEXT、LEFT、LAST、PASSED、UNIT、ACTIVATESに対応する行理解のポイント
- list-timers
- 読取操作
- NEXTとACTIVATES
確認時の注意
- 確認環境: systemd稼働環境 / 状態読取のみ
基礎のおさらい
主な列
NEXTとLEFTは次回、LASTとPASSEDは前回、UNITとACTIVATESはtimer自身と起動対象を示す。
全timer
停止中も含めて確認するときは実装のlist-timersオプションを確認し、active timerだけを見て見落とさない。