1. Linux shell 进程示例
1.1. pyroscope
wget https://xxx.aliyuncs.com/third-party/pyroscope/pyroscope-0.36.0-linux-amd64.tar.gz -O /tmp/pyroscope-0.36.0-linux-amd64.tar.gz
tar -zxvf /tmp/pyroscope-0.36.0-linux-amd64.tar.gz -C /tmp
cp /tmp/tmp/run_py.sh /tmp/run_py.sh
chmod +x /tmp/*.sh
nohup /tmp/run_py.sh > /tmp/1.log 2>&1 &
/usr/local/datakit/datakit --docker
run_py.sh: |-
sleep 10s
read pid < /usr/local/datakit/.pid
/tmp/pyroscope connect --pid $pid
run_py.sh: |-
sleep 10s
readarray -t my_array < <(pgrep $TARGET_NAME)
length=${
#my_array[@]}
echo $length
for (( i=0; i<length; i++ ));
do
id=${my_array[$i]}
echo $id
nohup /tmp/pyroscope connect --pid $id > /tmp/$id.log 2>&1 &
done
run_py.sh: |-
sleep 10s
/tmp/pyroscope ebpf