• 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==========================================
  • 相关阅读:
    Hibernate学习(2)- hibernate.cfg.xml详解
    Hibernate学习(1)- 初识
    linux(centos6) 常用操作
    linux(centos6) 下安装 postgresql-9.3.1.tar.gz
    struts2 值栈分析
    struts2 paramsPrepareParamsStack拦截器简化代码(源码分析)
    idea 配置maven
    idea 使用github
    idea 配置svn
    idea 配置tomcat
  • 原文地址:https://www.cnblogs.com/maisha/p/12166618.html
Copyright © 2020-2023  润新知