重启服务进程 shell脚本

来源:互联网 发布:乐视视频提示网络异常 编辑:程序博客网 时间:2024/05/21 09:29


1  备份 redis-server 数据 shell 脚本

#!/bin/sh
nowTimeS=`date +"%Y-%m-%d-%H:%M:%S"`
echo $nowTimes
cp ./dump.rdb ./backpak/dump$nowTimeS.rdb



2  重启游戏服务器 shell 脚本


#!/bin/sh
# Database info
DB_USER="batsing"
DB_PASS="batsingpw"
DB_HOST="localhost"
DB_NAME="timepusher"
# Others vars
REDIS_DIR="/root/"            #the mysql bin path
BACK_DIR="/root/backup"    #the backup file directory
DATE=`date +%F`
ps -ef|grep -v grep|grep XXGame|while read u p o
#PROCESS=`ps -ef|grep $1|grep -v grep|grep -v PPID|awk 'XXGame'`
do
  echo "Kill the process [" $p" ]"
  kill -9 $p
done
ps -ef|grep -v grep|grep XXGateway|while read u pp o
#PROCESS=`ps -ef|grep $1|grep -v grep|grep -v PPID|awk 'XXGateway'`
do
  echo "Kill the process [" $pp" ]"
  kill -9 $pp
done
sleep 2s
cd /usr/server/XXDC/gateway/
nohup ./XXGateway &
cd ../game/
nohup ./XXGame &

//---------------------------------------
windows下文件转换到  linux下,  文件格式转换, 否则 报错。
vi  ****.sh
:set fileformat=unix
:wq
//----------------------------------------------------

0 0