add restart.sh
This commit is contained in:
parent
850297aa91
commit
16675566db
31
server/bin/restart.sh
Executable file
31
server/bin/restart.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/profile
|
||||
source /root/.bash_profile
|
||||
|
||||
function kill_old_servers() {
|
||||
ps -ef|grep "valgrind ./gameserver -i$1"|grep -v grep
|
||||
if [ $? -eq 0 ]; then
|
||||
ps -ef|grep "valgrind ./gameserver -i$1"|grep -v grep|awk '{print $2}'|xargs kill -9
|
||||
fi
|
||||
|
||||
ps -ef|grep "gameserver -i$1"|grep -v grep
|
||||
if [ $? -eq 0 ]; then
|
||||
ps -ef|grep "gameserver -i$1"|grep -v grep|awk '{print $2}'|xargs kill -9
|
||||
fi
|
||||
}
|
||||
|
||||
function start_new_servers() {
|
||||
nouse_valgrind=$2
|
||||
if [ "$nouse_valgrind" = "1" ]; then
|
||||
nohup ./gameserver -i $1 > gameserver.out 2>&1 &
|
||||
sleep 1
|
||||
else
|
||||
nohup valgrind ./gameserver -i $1 > gameserver.out 2>&1 &
|
||||
sleep 1
|
||||
fi
|
||||
echo restart ok
|
||||
}
|
||||
|
||||
kill_old_servers
|
||||
start_new_servers $1 $2
|
Loading…
x
Reference in New Issue
Block a user