#!/bin/bash
#program:runall and checkall process
#author:sundz 20220606 v1
如果此用户不存在这个,则配置为1
aboss5_flag=0
aboss2_flag=0
mycat_flag=0
mysql_flag=0
Svn_flag==0
procmgr-aboss5 start
procmgr5_ids=ps x | grep procmgr | grep -v "grep" | awk '{print $1}'
for id in $procmgr5_ids
do
pathDir=ls -al /proc/$id/cwd | awk '{print $NF}'
echo [$id]:[$pathDir]
if [[ "$pathDir" == *"aboss5"* ]]; then
aboss5_flag=1
echo "[NOTE] aboss5 procmgr is already started."
fi
done
procmgr-aboss2 start
procmgr2_ids=ps x | grep procmgr | grep -v "grep" | awk '{print $1}'
for id in $procmgr2_ids
do
pathDir=ls -al /proc/$id/cwd | awk '{print $NF}'
echo [$id]:[$pathDir]
if [[ "$pathDir" == *"aboss2"* ]]; then
aboss2_flag=1
echo "[NOTE] aboss2 procmgr is already started."
fi
done
aboss5 procmgr start
if [ "$aboss5_flag" == "0" ]; then
cd ~/aboss5/bin
./procmgr -d&
fi
aboss2 procmgr start
if [ "$aboss2_flag" == "0" ]; then
cd ~/aboss2/bin
# export LC_ALL="zh_CN.GBK"
./procmgr -d&
fi
Mycat startup
if [ "$mycat_flag" == "0" ]; then
mycat_id=ps x | grep mycat | grep -v "grep" | awk '{print $1}'
if [ -z "$mycat_id" ]; then
cd ~/mycat/bin
./mycat start
else
mycat_flag=1
echo "[NOTE] Mycat is already started."
fi
fi
Mysql startup
if [ "$mysql_flag" == "0" ]; then
mysql_id=ps x | grep mysql | grep -v "grep" | awk '{print $1}'
if [ -z "$mysql_id" ]; then
echo "[ERROR] Mysql is not running!!!!."
else
mysql_flag=1
echo "[NOTE] Mysql is already started."
fi
fi
Svn startup
if [ "$Svn_flag" == "0" ]; then
Svn_id=ps x | grep Svn | grep -v "grep" | awk '{print $1}'
if [ -z "$Svn_id" ]; then
echo "[ERROR] Svn is not running!!!!."
else
Svn_flag=1
echo "[NOTE] Svn is already started."
fi
fi
Original: https://www.cnblogs.com/sunfankun/p/16553424.html
Author: 孙犯困
Title: HTS-一键启动
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/583098/
转载文章受原作者版权保护。转载请注明原作者出处!