V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
git00ll
V2EX  ›  问与答

smartctl 的日志怎么输出到 syslog 里面

  •  
  •   git00ll · 42 天前 · 566 次点击
    这是一个创建于 42 天前的主题,其中的信息可能已经有所发展或是发生改变。

    想要定时执行 smartctl 的 self-test ,并且通过扫描 syslog 的日志在 motd 中展示是否自检通过。

    但是执行 smartctl -t short /dev/sda 始终无法将日志输出到 syslog 中,不知道哪里漏配置了还是啥。

    大概像下面这样的日志,,曾经不知道输入了啥出现过,后来就再也出不来了,有大佬知道吗

    2024-08-06T01:44:51.359610+08:00 debian smartd[2350]: Device: /dev/sda [SAT], self-test in progress, 70% remaining
    2024-08-06T02:14:51.595760+08:00 debian smartd[2350]: Device: /dev/sda [SAT], self-test in progress, 30% remaining
    2024-08-06T02:44:51.875260+08:00 debian smartd[2350]: Device: /dev/sda [SAT], self-test in progress, 10% remaining
    2024-08-06T03:14:51.159457+08:00 debian smartd[2350]: Device: /dev/sda [SAT], previous self-test completed without error
    
    

    还想问一下,通过 crontab 的方式定时执行自检这种方案合理吗

    3 条回复    2024-08-09 10:08:09 +08:00
    yinmin
        1
    yinmin  
       42 天前 via iPhone
    试试这个:

    smartctl -t short /dev/sda 2>&1 | /usr/bin/systemd-cat -t smartctl
    dbak
        2
    dbak  
       41 天前
    -l TYPE, --log=TYPE
    Show device log. TYPE: error, selftest, selective, directory[,g|s],
    xerror[,N][,error], xselftest[,N][,selftest], background,
    sasphy[,reset], sataphy[,reset], scttemp[sts,hist],
    scttempint,N[,p], scterc[,N,M], devstat[,N], defects[,N], ssd,
    gplog,N[,RANGE], smartlog,N[,RANGE], nvmelog,N,SIZE
    julyclyde
        3
    julyclyde  
       41 天前
    smartd
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1006 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 22:13 · PVG 06:13 · LAX 15:13 · JFK 18:13
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.