zoukankan      html  css  js  c++  java
  • shell脚本添加脚本执行时间和当前运行次数current running time

     1 #!/bin/bash
     2 ############################
     3 #Author:Bing
     4 #Create time:3/31/2017
     5 ############################
     6 i=0
     7 count=0
     8 startdate=`date`
     9 folder=`date +"%Y%m%d"`
    10 file1=psu_speed.log
    11 file2=psu_i2c_5a.log
    12 file3=psu_i2c_5b.log
    13 file4=psu_airflow_5a.log
    14 file5=psu_airflow_5b.log
    15 file6=cpu_i2c.log
    16 if [ -d $folder ];then
    17 rm -rf $folder
    18 else
    19 mkdir $folder
    20 fi
    21 mkdir $folder
    22 echo
    23 echo =======================PuTTY log ${startdate}====================
    24 echo
    25 start_time=`date +%s`
    26 while true
    27  do
    28     #/home/diagtool/fct_seastone/psu_i2c.sh 0x5a |tee $file1
    29     /home/diagtool/fct_seastone/diagtool psu_speed |tee -a $folder/$file1
    30     sleep 2
    31     /home/diagtool/fct_seastone/psu_i2c_48V.sh 0x5a |tee -a $folder/$file2
    32     sleep 2
    33     /home/diagtool/fct_seastone/psu_i2c_48V.sh 0x5b |tee -a $folder/$file3
    34     sleep 2
    35     /home/diagtool/fct_seastone/psu_airflow.sh 0x5a |tee -a $folder/$file4
    36     sleep 2
    37     /home/diagtool/fct_seastone/psu_airflow.sh 0x5b |tee -a $folder/$file5
    38     sleep 2
    39     /home/diagtool/fct_seastone/i2c_access.sh |tee -a $folder/$file6
    40     sleep 5
    41      
    42     i=$[$i+1]
    43     echo =====current running $i times=============== 
    44 
    45 done
    46 end_time=`date +%s`
    47 
    48 cost_time=$[ end_time - start_time ]
    49 echo Total running count=${i}time
    50 echo "Total running times=$cost_time seconds"
    51 echo ========================log end==========================================
  • 相关阅读:
    Typora集成免费图床:PicGo + Gitee
    Github shields徽章配置方法介绍
    Python爬虫的简易流程
    MVC学习系列——Filter扩展
    MVC学习系列——ActionResult扩展
    JQuery插件,傻傻分不清!
    闲谈前端编码解码、C#编码解码。
    年终总结和职业规划
    MVC学习系列——记一次失败面试后,感想。
    C/C++四种退出线程的方法
  • 原文地址:https://www.cnblogs.com/maisha/p/12166618.html
Copyright © 2011-2022 走看看