시작 시간 가져오기

시작 시간 가져오기

나는 라즈베리 파이를 가지고 있습니다. 나는 crontab을 실행하고 있으며 매일 정오에 다시 시작하도록 지시합니다( sudo reboot now).

결과는 다음과 같습니다 last reboot -F.

myuser@mypiname:~ $ last -F reboot
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970   still running
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970   still running
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970   still running
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Tue Oct 27 12:00:33 2020 (18562+11:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Tue Oct 27 12:00:03 2020 (18562+11:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Mon Oct 26 12:01:00 2020 (18561+11:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Mon Oct 26 12:00:31 2020 (18561+11:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Mon Oct 26 12:00:03 2020 (18561+11:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Mon Oct 26 12:00:03 2020 (18561+11:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Mon Oct 26 12:00:03 2020 (18561+11:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sun Oct 25 12:00:33 2020 (18560+11:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sun Oct 25 12:00:03 2020 (18560+11:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sat Oct 24 12:00:33 2020 (18559+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sat Oct 24 12:00:04 2020 (18559+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Fri Oct 23 12:00:03 2020 (18558+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct 22 12:00:44 2020 (18557+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct 22 12:00:11 2020 (18557+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Wed Oct 21 12:00:06 2020 (18556+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Tue Oct 20 12:00:33 2020 (18555+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Tue Oct 20 12:00:04 2020 (18555+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Mon Oct 19 12:00:33 2020 (18554+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Mon Oct 19 12:00:03 2020 (18554+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sun Oct 18 12:00:04 2020 (18553+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sat Oct 17 12:00:04 2020 (18552+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Fri Oct 16 12:00:33 2020 (18551+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Fri Oct 16 12:00:03 2020 (18551+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Fri Oct 16 12:00:03 2020 (18551+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct 15 12:00:34 2020 (18550+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct 15 12:00:04 2020 (18550+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Wed Oct 14 12:00:04 2020 (18549+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Wed Oct 14 12:00:04 2020 (18549+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Wed Oct 14 12:00:04 2020 (18549+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Tue Oct 13 12:00:33 2020 (18548+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Tue Oct 13 12:00:03 2020 (18548+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Mon Oct 12 12:00:36 2020 (18547+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Mon Oct 12 12:00:04 2020 (18547+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sun Oct 11 12:00:34 2020 (18546+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sun Oct 11 12:00:04 2020 (18546+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sat Oct 10 12:00:33 2020 (18545+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sat Oct 10 12:00:04 2020 (18545+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Fri Oct  9 12:02:03 2020 (18544+10:02)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Fri Oct  9 12:00:04 2020 (18544+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct  8 12:00:34 2020 (18543+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct  8 12:00:04 2020 (18543+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Wed Oct  7 12:00:33 2020 (18542+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Wed Oct  7 12:00:04 2020 (18542+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Tue Oct  6 12:00:04 2020 (18541+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Mon Oct  5 17:38:18 2020 (18540+15:38)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Mon Oct  5 12:00:04 2020 (18540+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sun Oct  4 12:00:33 2020 (18539+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sun Oct  4 12:00:03 2020 (18539+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Sat Oct  3 12:00:04 2020 (18538+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Fri Oct  2 12:00:03 2020 (18537+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Fri Oct  2 12:00:03 2020 (18537+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct  1 18:07:11 2020 (18536+16:07)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct  1 18:07:11 2020 (18536+16:07)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct  1 18:07:11 2020 (18536+16:07)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct  1 18:07:11 2020 (18536+16:07)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct  1 18:07:11 2020 (18536+16:07)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct  1 12:01:00 2020 (18536+10:00)
reboot   system boot  4.19.66-v7+      Thu Jan  1 01:00:01 1970 - Thu Oct  1 12:00:31 2020 (18536+10:00)

wtmp begins Thu Oct  1 10:28:43 2020

오늘(2020년 10월 27일 13:55:XX) 오후 2시경에 라즈베리 파이의 플러그를 뽑았지만 여기에는 플러그가 뽑힌 것으로 표시되지 않습니다(아마 재부팅하지 않았기 때문일 것입니다).

마지막 재부팅 시간 대신 마지막 부팅 시간을 어떻게 알 수 있나요? 또한 마지막 부팅 시간뿐만 아니라 "모든" 부팅 시간을 갖고 싶습니다.

시도해 보았지만 last boot -F아무 것도 표시되지 않습니다.

답변1

시작 시간 가져오기

Pi에서 직면하는 첫 번째 문제. 시작 로그는 장치가 네트워크 시간 서버에서 시간을 얻기 전에 생성됩니다. 장치에는 배터리로 지원되는 시계가 없으므로 처음부터 고장났습니다 1970-01-01T00:00(역시 고장났습니다 who -b).

당신과 내 기록의 두 번째 날짜는 합리적으로 보이지만 실제로는 마감 시간입니다.

이 장치의 부팅 시간을 기록하는 방법을 찾아야 합니다.

몇 가지 생각

uptime --since정확한 시작 시간을 알려주십시오. (이제 시스템의 시간이 정확해졌습니다).

시작 또는 다시 시작

다음으로 재부팅과 시작이 무엇을 의미하는지 질문해야 합니다. 안내만 합니다. 하지만 종료 프로세스가 있는지 확인할 수 있습니다. 우리는 시차를 볼 수 있습니다. 어떤 유형의 종료인지(문서화되어 있는지는 모르겠습니다) 확인할 수 있습니까? 다시 시작 유형의 종료인가요?

답변2

노력하다

 $ who -b

마지막 부팅 시간을 알 수 있습니다.

답변3

나는 다른 해결책을 모색합니다. 부팅 시 정확한 시간(초)이 필요하지 않으므로 cron재부팅 시 로깅을 사용하도록 선택합니다.

@reboot  echo "Rebooting at $(date)" >> /path/to/some/file

@ctrl-alt-delor의 의견에서 영감을 얻었습니다.

관련 정보