当前位置:网站首页>Shell practice: one click start process, close process and view process status
Shell practice: one click start process, close process and view process status
2022-07-23 14:15:00 【hys__ handsome】
All the way to Databend Take the program as an example to practice
Databend Official documents :https://databend.rs/doc
The driving force of practice : Manual start 、 close 、 It's too troublesome to check the status , Go straight up Shell Script ( Add execution permission manually chmod +x xx.sh)
One button start
involves :command Splicing
path="/usr/bin/databend/bin"
${path}/databend-meta -c ./configs/databend-meta.toml > meta.log 2>&1 &
${path}/databend-query -c ./configs/databend-query.toml > query.log 2>&1 &
One button closure
Knowledge points involved :
- Array operation ( Take the length of the array )
- String segmentation ( adopt for loop )
- Before selection n That's ok (head command )
- Select the first n Column (awk command , The content is huge )
- Arithmetic syntax
ifProcess control
# get pid list
ls=`ps -elf | grep databend | head -n 2 | awk '{print $4}'`
# Cut string
len=0
for pid in ${ls[*]}
do
pids[len]=$pid
len=`expr $len + 1`
# echo ${pid}
done
# pids The array length is greater than 1
if [ ${
#pids[@]} -gt 1 ]
then
for i in ${pids[*]}
do
kill -9 ${i}
done
echo "databend is stoped"
else
echo "databend no starting"
fi
One click View
echo '----------server-status-------------'
curl -I http://127.0.0.1:8101/v1/health
curl -I http://127.0.0.1:8001/v1/health
echo '----------process-info-------------'
ps -elf | grep databend
边栏推荐
- rtx3080ti和3090差距 rtx3080ti和3090哪个性价比高
- 网络安全笔记1——Internet协议的安全性
- iQOO 10 Pro和vivo X80 Pro区别 哪个好详细参数配置对比
- Uiscrollview (uicollectionview) prohibits horizontal and vertical sliding at the same time
- 4. 寻找两个正序数组的中位数
- Renforcement de l'apprentissage - points de compréhension du gradient stratégique
- FPGA工程师如何进行复杂系统设计?
- Day 12 notes
- The shell needs to know the commands when running
- How many processors is Tianji 820 equivalent to Xiaolong? How about Tianji 1100 equivalent to Xiaolong? How about Tianji 820
猜你喜欢

Detailed explanation of knapsack problem

锐龙R7 PRO 5875U性能怎么样?相当于什么水平级别

Notes on the sixth day

What level is the notebook core i5 1135g7 equivalent to? How about i5 1135g7 performance

英特尔赛扬7300性能怎么样?相当于什么水平级别

Detailed introduction of RIP

第八天笔记

完全背包!

Is machine learning difficult to get started? Tell me how I started machine learning quickly!

What's the difference between core i9 12950hx and i9 12900hx
随机推荐
第九天笔记
太平洋大西洋水流问题
Notes on the fifth day
How about the nuclear display performance of Ruilong R7 Pro 6850h? What level is it equivalent to
剑指offer19 正则表达式
Shell实践:一键启动进程、关闭进程、查看进程状态
What's the difference between core i9 12950hx and i9 12900hx
Detailed explanation of knapsack problem
What is Tianji 920 equivalent to a snapdragon? How much is Tianji 920 equivalent to a snapdragon? How about Tianji 920
赛扬n5095处理器怎么样 英特尔n5095核显相当于什么水平
How about Celeron n5095 Processor? What is the equivalent level of Intel n5095 core display
Interface
完全背包!
Day 11 notes
Spark counts new users every day
MySQL enables scheduled task execution
酷睿i5 12490f和i5 12600k差距大吗
How to open the thought map pdf of postgraduate entrance examination in the small program of postgraduate entrance examination question bank
动态规划-- 背包问题
AppScan的安装与使用