首页 学习记录 正文
  • 本文约1096字,阅读需5分钟
  • 2120
  • 0

1043六电口9USB看门狗脚本

eth和uart看门狗程序执行


先允许看门狗操作,两个命令之间延迟0.001秒,然后进行清狗循环,一次清狗后5秒延迟再进行循环

#!/bin/bash
./cpldrw_test 0x08 0x01
sleep 0.001
./cpldrw_test 0x11 0x01
sleep 0.001
while true
do
./cpldrw_test 0x13 0x00
sleep 0.001
./cpldrw_test 0x13 0x01
0.1
./cpldrw_test 0x09 0x00
sleep 0.001
./cpldrw_test 0x09 0x01
    sleep 5

 done 


执行脚本循环脚本,网口开启,执行循环语句,当检测到网口没有running则停止执行脚本

#!/bin/bash
ifconfig eth0 up
ifconfig eth1 up
ifconfig eth2 up
ifconfig eth3 up
ifconfig eth4 up
ifconfig eth5 up
./cpldrw_test 0x08 0x01
while true
do
./cpldrw_test 0x13 0x00
sleep 0.001
./cpldrw_test 0x13 0x01
   sleep 3
ifconfig eth1 | grep 'RUNNING' >/dev/null 2>&1
if [ $? -eq 0 ] ;then
  echo "yes" > /dev/null 2>&1
else
  kill  $(ps aux|grep bypass.sh|grep -v "grep"|awk '{print $1}')
fi
sleep 2
 done


执行脚本,开启网口,执行看门狗程序,当网口为running时循环执行看门狗程序,当网口没有running则停止执行脚本

#!/bin/bash
ifconfig eth0 up
ifconfig eth1 up
ifconfig eth2 up
ifconfig eth3 up
ifconfig eth4 up
ifconfig eth5 up
./cpldrw_test 0x08 0x01
sleep 1
 ./cpldrw_test 0x13 0x00
sleep 0.001
./cpldrw_test 0x13 0x01
   sleep 5
while true
do
ifconfig eth1 | grep 'RUNNING' >/dev/null 2>&1
if [ $? -eq 0 ] ;then
  ./cpldrw_test 0x13 0x00;sleep 0.001;./cpldrw_test 0x13 0x01;sleep 5
else
  kill  $(ps aux|grep bypassnew.sh|grep -v "grep"|awk '{print $1}')
fi
 done








标签:femrice


    评论
    更换验证码
    友情链接