1.创建命令脚本compact.sh
写入内容:
#!/bin/bash
time_start=`date \"+%Y-%m-%d %H:%M:%S\"`
echo \"开始进行H 的大合并.时间:${time_start}\"
str=`echo list | h shell | sed -n \'$p\'`
#str=\"a,b,c\"
str=${str//,/ }
arr=($str)
length=${#arr[@]}
current=1
echo \"H 中总共有${length}张表需要合并.\"
echo \"balance_switch false\" | h shell | > /dev/null
echo \"H 的负载均衡已经关闭\"
for each in ${arr[*]}
do
table=`echo $each | sed \'s/]//g\' | sed \'s/\\[//g\'`
echo \"开始合并第${current}/${length}张表,表的名称为:${table}\"
echo \"major_compact ${table}\" | h shell | > /dev/null
let current=current+1
done
echo \"balance_switch true\" | h shell | > /dev/null
echo \"H 的负载均衡已经打开.\"
time_end=`date \"+%Y-%m-%d %H:%M:%S\"`
echo \"H 的大合并完成.时间:${time_end}\"
((duration=$(date +%s -d \"$time_end\")-$(date +%s -d \"$time_start\")))
echo \"耗时:${duration}s\"
2.创建后台调用脚本start.sh
写入内容:
nohup ./compact.sh > log 2>&1 &
继续阅读与本文标签相同的文章
-
二维码如此普及,为何三维码没办法普及
2026-05-19栏目: 教程
-
山东有效专利量前十企业和前十大专院校名单来啦,第一名你想到了吗
2026-05-19栏目: 教程
-
两种ASO应用优化的核心操作方法
2026-05-19栏目: 教程
-
第126届广交会15日开幕,新产品新技术受青睐
2026-05-19栏目: 教程
-
多位知名专家建言 宁波打造中国隐形冠军之城
2026-05-19栏目: 教程
