私はLinuxを初めて使用し、正しい方法でタスクを実行しても、常に安全ではありません。時々、再起動を使用するRaspbianシステム(ソフトウェアではなく問題の場合)があり、再起動するたびにログインが必要になる場合があります。私の考えは次のとおりです。 crontabの操作は次のとおりです。
@reboot date >> /var/log/reboots
効果があるもっとエレガントなものがありますか?解決策が許容可能であれば、日付ファイルシステムがいっぱいになるのを防ぐためにログファイルを「ローリング」する方法はありますか?)?
ベストアンサー1
Debian では、再起動が記録されます。 ~からman last
:
Last searches back through the file /var/log/wtmp (or the file desig-
nated by the -f flag) and displays a list of all users logged in (and
out) since that file was created.
...
The pseudo user reboot logs in each time the system is rebooted. Thus
last reboot will show a log of all reboots since the log file was cre-
ated.
このファイルは既定でログのローテーションに既に存在する必要があります/var/log/wtmp
(参考資料を参照/etc/logrotate.conf
)。
次のオプションを使用して古いログファイルを使用できます-f
。
last reboot -f /var/log/wtmp.1