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==========================================


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM