systemd 타이머 - 타이머 실행 내역을 얻는 방법

systemd 타이머 - 타이머 실행 내역을 얻는 방법
systemctl status mytimer.timer

언제 활성화되고 다음 트리거가 언제 실행되는지 알려주세요. 과거 타이머 실행 시간 목록을 얻는 방법은 무엇입니까?

답변1

타이머를 나열하고 로그/로그 단위 기록을 표시합니다.

systemctl list-timers
# replace motd-news with mytimer
journalctl -u motd-news.timer

산출:

-- Logs begin at Fri 2018-11-02 13:17:39 CDT, end at Sat 2018-11-03 11:20:59 CDT. --
Nov 02 13:17:52 pop-os systemd[1]: Started Message of the Day.
Nov 02 18:45:46 pop-os systemd[1]: Stopped Message of the Day.
-- Reboot --
Nov 02 18:46:47 pop-os systemd[1]: Started Message of the Day.
-- Reboot --
Nov 03 07:57:27 pop-os systemd[1]: Started Message of the Day.

다른 유용한 플래그:

  • --since시작 시간부터 현재 시간까지
  • --until시간 범위를 얻기 위해 Since와 함께 사용됨
  • --reverse최신순으로 표시
  • --grep메시지의 패턴을 grep으로 검색

시간을 얻기 위해 관심 있는 다른 플래그는 플래그 f --output뿐만 아니라 이 플래그를 사용합니다.--output-field

-o, --output= 표시되는 저널 항목의 형식을 제어합니다. 다음 옵션 중 하나를 사용하십시오.

   short
       is the default and generates an output that is mostly identical to the formatting of classic syslog files, showing one line
       per journal entry.

   short-full
       is very similar, but shows timestamps in the format the --since= and --until= options accept. Unlike the timestamp information shown in short output mode this mode
       includes weekday, year and timezone information in the output, and is locale-independent.

   short-iso
       is very similar, but shows ISO 8601 wallclock timestamps.

   short-iso-precise
       as for short-iso but includes full microsecond precision.

   short-precise
       is very similar, but shows classic syslog timestamps with full microsecond precision.

   short-monotonic
       is very similar, but shows monotonic timestamps instead of wallclock timestamps.

   short-unix
       is very similar, but shows seconds passed since January 1st 1970 UTC instead of wallclock timestamps ("UNIX time"). The time is
       shown with microsecond accuracy.

   verbose
       shows the full-structured entry items with all fields.

   export
       serializes the journal into a binary (but mostly text-based) stream suitable for backups and network transfer (see
       Journal Export Format[1] for more information). To
       import the binary stream back into native journald format use systemd-journal-remote(8).

   json
       formats entries as JSON data structures, one per line (see Journal JSON Format[2] for more information).

   json-pretty
       formats entries as JSON data structures, but formats them in multiple lines in order to make them more readable by humans.

   json-sse
       formats entries as JSON data structures, but wraps them in a format suitable for Server-Sent Events[3].


  cat
       generates a very terse output, only showing the actual message of each journal entry with no metadata, not even a timestamp.

--출력 필드=

       A comma separated list of the fields which should be included in the output. This only has an effect for the output modes which
       would normally show all fields (verbose,
       export, json, json-pretty, and json-sse). The "__CURSOR", "__REALTIME_TIMESTAMP", "__MONOTONIC_TIMESTAMP", and "_BOOT_ID" fields
       are always printed.

관련 정보