40 lines
1006 B
Bash
40 lines
1006 B
Bash
|
|
#!/bin/sh
|
||
|
|
|
||
|
|
#date:20191219
|
||
|
|
|
||
|
|
#禁止以root用户运行
|
||
|
|
curuser=`whoami`
|
||
|
|
if [ $curuser = "root1" ];then
|
||
|
|
echo "root Operation is not allowed!!"
|
||
|
|
exit -1
|
||
|
|
fi
|
||
|
|
|
||
|
|
#定义清除内存函数
|
||
|
|
function clear_all_shmkey(){
|
||
|
|
cd /data/home/mmog/center_relay_900_1/runenv/msgq
|
||
|
|
sh clear.sh >/dev/null
|
||
|
|
|
||
|
|
ipcrm -M 11018
|
||
|
|
ipcrm -M 21014
|
||
|
|
ipcrm -M 31014
|
||
|
|
|
||
|
|
ipcs -m|grep ^0x |awk '$6==0{print $2}'|xargs -I {} ipcrm -m {}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
#统计进程总数
|
||
|
|
proc_count=`ps -ef|grep 'agame_zs_900\>'|grep -v grep|egrep 'center_relay_10_900_1_ag|relay_busd_svr_10_900_1_ag' |wc -l`
|
||
|
|
|
||
|
|
#执行清除操作
|
||
|
|
if [ "${proc_count}" == "0" ];then
|
||
|
|
echo "---------------A5game_中顺_900_1服-------------"
|
||
|
|
clear_all_shmkey
|
||
|
|
echo "-------------- 清除共享内存操作结束 --------------"
|
||
|
|
else
|
||
|
|
echo "---------------A5game_中顺_900_1服-------------"
|
||
|
|
echo "当前还有${proc_count}个进程正在运行"
|
||
|
|
echo "请先停止正在运行的进程,再执行此操作"
|
||
|
|
echo "--------------------------------------------------"
|
||
|
|
fi
|