1 备份 redis-server 数据 shell 脚本
#!/bin/sh
nowTimeS=`date +"%Y-%m-%d-%H:%M:%S"`
echo $nowTimes
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
# 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 &
cd ../game/
nohup ./XXGame &
//---------------------------------------
windows下文件转换到 linux下, 文件格式转换, 否则 报错。
vi ****.sh
:set fileformat=unix
:wq
//----------------------------------------------------