#!/bin/bash
#取jms进程号
Das_ID=$(ps -ef |grep "python3 ./jms start" |grep -v "grep"| awk '{print $2}')
Das_Id=$( ps -ef |grep "python3 ./jms start" |grep -v "grep"| awk '{print $2}' | wc -l)
if [ $Das_Id -eq 0 ];then
echo ""
echo "===当前系统没有运行jms==="
fi
if [ $Das_Id -ne 0 ];then
echo ""
echo "######打印jms进程号######"
echo "# #"
echo "# $Das_ID #"
echo "# #"
echo "#########################"
echo ""
echo "########关闭jms进程######"
kill -9 $Das_ID
echo "# #"
echo "# 进程 $Das_ID 关闭成功! #"
echo "# #"
echo "#########################"
fi
Das_Id_a=$( ps -ef |grep "python3 ./jms start" |grep -v "grep"| awk '{print $2}' | wc -l)
DATE=`date +%Y-%m-%d`
echo ""
echo "#########启动jms#########"
echo "# #"
if [ $Das_Id_a -eq 0 ];then
cd /opt/jumpserver && nohup ./jms start >>/topsun/ztc/DAS/logs/das_${DATE}.log 2>&1 &
echo "# 启动成功! #"
fi
echo "# #"
echo "#########################"
echo ""
shell脚本实现杀死进程并启动程序(重启程序)【显哥出品,必为精品】
您必须 登录 才能发表评论!
(2)个小伙伴在吐槽
- I may need your help. I tried many ways but couldn't solve it, but after reading your article, I think you have a way to help me. I'm looking forward for your reply. Thanks.
- Reading your article has greatly helped me, and I agree with you. But I still have some questions. Can you help me? I will pay attention to your answer. thank you.



