Last active
April 15, 2022 12:02
-
-
Save peytonyip/77365966150dac573963c04dc731683c to your computer and use it in GitHub Desktop.
Revisions
-
peytonyip revised this gist
Apr 15, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ dbs=("chatbot" "chatbot_kg" "chatbot_v2" "chatbot_walle" "nlp_asr_tts_ws" "quali for ((i=0;i<${#dbs[@]};i++)) do cd /home/work/workplace/backup || exit db=${dbs[$i]} /home/work/workplace/mariadb-10.4.8/bin/mysqldump -ubackup_ro -pbackup_ro -h172.18.36.235 --lock-tables=false --quick --databases "${db}" > "${db}-${datetime}.sql" done -
peytonyip revised this gist
Jan 12, 2021 . 1 changed file with 18 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ #!/bin/bash - # top -n 参数指定运行次数,1代表运行一次即停止,不再等待top数据更新,使用awk指定分割符,提取数据 cpu_us=`top -n 1 | grep 'Cpu(s)' | awk -F'[" "%]+' '{print $2}'` cpu_sy=`top -n 1 | grep 'Cpu(s)' | awk -F'[" "%]+' '{print $4}'` cpu_idle=`top -n 1 | grep 'Cpu(s)' | awk -F'[" "%]+' '{print $8}'` # 默认bash shell不能直接运算小数点,所以需要借助bc # bc命令是一种支持任意精度的交互执行的计算器语言。 # 常见用法 echo "1.23*5" | bc cpu_sum=$(echo "$cpu_us+$cpu_sy"|bc) echo "CPU_SUM: $cpu_sum%" echo "CPU_Idle: ${cpu_idle}%" #超过阀值即发送邮件 if [ $cpu_sum -ge 90 ];then echo "CPU utilization $cpu_sum" | mail -s "cpu status warning." [email protected] fi -
peytonyip created this gist
Nov 23, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #!/bin/bash datetime=$(date +%Y%m%d%H%M%S) dbs=("chatbot" "chatbot_kg" "chatbot_v2" "chatbot_walle" "nlp_asr_tts_ws" "quality_check" "sound" "walle_deploy") #dbs=("walle_deploy") for ((i=0;i<${#dbs[@]};i++)) do cd /home/work/workplace/backup db=${dbs[$i]} /home/work/workplace/mariadb-10.4.8/bin/mysqldump -ubackup_ro -pbackup_ro -h172.18.36.235 --lock-tables=false --quick --databases "${db}" > "${db}-${datetime}.sql" done find /home/work/workplace/backup -mtime +7 -name "*.*" -exec rm -rf {} \;