相关疑难解决方法(0)

为什么 `journalctl --list-boots` 与 `uptime` 和 `who -b` 报告的内容不匹配?

这是我使用的测试脚本:

last_reboot=$(last reboot | grep 'still running' | awk '{for (i=5; i<=NF; i++) printf $i FS}' | awk '{for (i=1; i<=NF - 2; i++) printf $i FS}')
if [ "$last_reboot" ]; then
    date -d "$last_reboot" '+last reboot: %Y-%m-%d'
fi

days=$(uptime | awk '{print $3}')
hours=$(uptime | awk '{print $5}' | sed -E 's/,$//')
h=$(echo "$hours" | cut -d: -f 1)
m=$(echo "$hours" | cut -d: -f 2)
date -d "- $days days - $h hours - $m minutes" '+uptime: %Y-%m-%d' …
Run Code Online (Sandbox Code Playgroud)

boot systemd reboot journalctl systemd-journald

5
推荐指数
1
解决办法
8577
查看次数

`last` 命令输出的第 10 列的目的是什么?

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 …
Run Code Online (Sandbox Code Playgroud)

last

3
推荐指数
1
解决办法
950
查看次数

标签 统计

boot ×1

journalctl ×1

last ×1

reboot ×1

systemd ×1

systemd-journald ×1