
last
RHELのコマンド出力に疑わしいパターンがあります。
$ last reboot
reboot system boot 3.10.0-514.21.1. Wed Dec 13 10:25 - 11:53 (01:28)
reboot system boot 3.10.0-514.21.1. Mon Oct 30 16:23 - 11:53 (43+20:30)
reboot system boot 3.10.0-514.21.1. Fri Oct 20 16:53 - 11:53 (53+20:00)
reboot system boot 3.10.0-514.21.1. Mon Oct 16 09:21 - 11:53 (58+03:32)
reboot system boot 3.10.0-514.21.1. Fri Aug 25 15:53 - 11:53 (109+21:00)
reboot system boot 3.10.0-514.21.1. Tue Aug 22 15:36 - 11:53 (112+21:16)
reboot system boot 3.10.0-514.21.1. Fri Jul 21 16:38 - 11:53 (144+20:15)
reboot system boot 3.10.0-514.21.1. Fri Jun 9 15:00 - 16:18 (42+01:17)
reboot system boot 3.10.0-514.21.1. Mon Jun 5 11:20 - 16:18 (46+04:57)
reboot system boot 3.10.0-514.21.1. Thu Jun 1 09:49 - 16:18 (50+06:28)
reboot system boot 3.10.0-514.el7.x Wed May 31 17:46 - 09:49 (16:02)
つまり、列10は複数の行にわたって同じ時間データを表示します(例:11:537回、そして16:183回)。
このman
ページでは、各列が何を表すべきかについては説明しません。
コマンド出力の列10の目的を知っていますかlast
?
答え1
再起動を一覧表示すると、10番目の列には起動後の最後の「ダウンタイム」が表示されます。つまりlast
システムの終了時間を決定できます。これには、実際にシステムに保存されている情報の複数の記録を組み合わせること、last
最後に見たダウンタイムを追跡し、「再起動」行が表示されたときにそれを盲目的に使用することが含まれます。
これにより、システムが突然シャットダウンした場合、シャットダウン時間は保存されず、以前のlast
履歴が使用されます。結果を見る:
reboot system boot 3.10.0-514.21.1. Wed Dec 13 10:25 - 11:53 (01:28)
reboot system boot 3.10.0-514.21.1. Mon Oct 30 16:23 - 11:53 (43+20:30)
reboot system boot 3.10.0-514.21.1. Fri Oct 20 16:53 - 11:53 (53+20:00)
reboot system boot 3.10.0-514.21.1. Mon Oct 16 09:21 - 11:53 (58+03:32)
reboot system boot 3.10.0-514.21.1. Fri Aug 25 15:53 - 11:53 (109+21:00)
reboot system boot 3.10.0-514.21.1. Tue Aug 22 15:36 - 11:53 (112+21:16)
reboot system boot 3.10.0-514.21.1. Fri Jul 21 16:38 - 11:53 (144+20:15)
reboot system boot 3.10.0-514.21.1. Fri Jun 9 15:00 - 16:18 (42+01:17)
reboot system boot 3.10.0-514.21.1. Mon Jun 5 11:20 - 16:18 (46+04:57)
reboot system boot 3.10.0-514.21.1. Thu Jun 1 09:49 - 16:18 (50+06:28)
reboot system boot 3.10.0-514.el7.x Wed May 31 17:46 - 09:49 (16:02)
last
12月13日11時53分に終了を表示する1つの記録と開始時刻を示す複数の記録が見つかったので、すべての記録に単一の終了時刻を使用しました。その後、6月9日16時18分から42日間の期限を見つけ、6月1日09:49まで他の期限を見つけられないため、これを何度も使用します。
することができますlast
ソースコードlastdown
;更新(および使用)された場所を見つけるには、「」を検索してください。