todo

bash sys monitor

up:2024-01-26 14:03:28 edit:2024-01-26 14:12:06 view:66
StLast=$(date +%s%N)
while true
do
        #{ time date -Ins } &>>"$0_check.out"
        # first {} to output time rst to out file,  nest {} to time all commands, (( and $(( to do math
        { time { St=$(date +%s%N) &&  NsTime=$((St-StLast-1000000000)) && StLast=$St && date -Ins && if (( NsTime > 500000000 )) ; then echo long time detect $((NsTime/1000000))ms; fi  ; } } &>>"$0_check.out"
        sleep 1
done


start:

nohup bash monitor_pause.sh  &>/dev/null &


not in sinaapp