参考 : shell 检测进程存在_小小分享的博客-CSDN博客_shell判断进程是否存在
cat > monitor_load.sh << 'EOF'
#!/bin/bash
name="load_batch.sh"
while true
do
count=`ps -ef | grep $name | grep -v "grep" | wc -l`
if [[ $count == 0 ]];then
echo "镜像导入已完成"
exit
else
time=`date '+%Y-%m-%d %H:%M:%S'`
echo "[$time]|镜像正在导入,请耐心等待..."
fi
sleep 5
done
EOF