zoukankan      html  css  js  c++  java
  • 掉电脉冲映射串口log和dmesg到文件中的log

    1.echo 1 > /mytest/boot_times

    2.systemctl enable i2c_dmesg.service

    root:/mytest# tree
    .
    |-- boot_times
    |-- i2c_dmesg.txt

    root:/etc# cat i2c_dmesg.sh
    #!/bin/sh

    value=$(cat /mytest/boot_times)

    # Keep dmesg file the same as console log
    echo "========sfl: reboot=$value========" >> /mytest/i2c_dmesg.txt
    /bin/dmesg >> /mytest/i2c_dmesg.txt
    echo "========sfl: reboot=$value========" > /dev/console

    let value=value+1
    echo $value > /mytest/boot_times

    sync

    sync

    root:/etc# cat /lib/systemd/system/i2c_dmesg.service 
    [Unit]
    Description=dmesg for i2c oops
    After=weston.service
    
    [Service]
    ExecStart=/etc/i2c_dmesg.sh
    Type=simple
    
    [Install]
    WantedBy=multi-user.target
  • 相关阅读:
    #张祖德#
    不说啥,放题
    ……
    点群的判别(四)
    lougu P4180 【模板】严格次小生成树[BJWC2010]
    20190227模拟
    20190226模拟
    Triangles
    Darling
    Suspenseful
  • 原文地址:https://www.cnblogs.com/hellokitty2/p/9735166.html
Copyright © 2011-2022 走看看