Browse Source

Added graceful stop for all unreal engine servers

pull/1310/head
Daniel Gibbs 8 years ago
parent
commit
4f75192b6c
  1. 11
      lgsm/functions/command_stop.sh

11
lgsm/functions/command_stop.sh

@ -221,7 +221,7 @@ fn_stop_graceful_mta(){
fn_stop_graceful_select(){ fn_stop_graceful_select(){
if [ "${gamename}" == "7 Days To Die" ]; then if [ "${gamename}" == "7 Days To Die" ]; then
fn_stop_graceful_sdtd fn_stop_graceful_sdtd
elif [ "${gamename}" == "Factorio" ]; then elif [ "${gamename}" == "Factorio" ]||[ "${engine}" == "unreal4" ]||[ "${engine}" == "unreal3" ]||[ "${engine}" == "unreal2" ]||[ "${engine}" == "unreal" ]; then
fn_stop_graceful_ctrlc fn_stop_graceful_ctrlc
elif [ "${engine}" == "source" ]; then elif [ "${engine}" == "source" ]; then
fn_stop_graceful_source fn_stop_graceful_source
@ -231,8 +231,6 @@ fn_stop_graceful_select(){
fn_stop_graceful_minecraft fn_stop_graceful_minecraft
elif [ "${engine}" == "renderware" ]; then elif [ "${engine}" == "renderware" ]; then
fn_stop_graceful_mta fn_stop_graceful_mta
elif [ "${engine}" == "unreal4" ]; then
fn_stop_graceful_ctrlc
else else
fn_stop_tmux fn_stop_tmux
fi fi
@ -254,7 +252,7 @@ fn_stop_ark(){
return return
fi fi
if [[ ${#queryport} -gt 0 ]] ; then if [ "${#queryport}" -gt 0 ] ; then
for (( pidcheck=0 ; pidcheck < ${maxpiditer} ; pidcheck++ )) ; do for (( pidcheck=0 ; pidcheck < ${maxpiditer} ; pidcheck++ )) ; do
pid=$(netstat -nap 2>/dev/null | grep ^udp[[:space:]] |\ pid=$(netstat -nap 2>/dev/null | grep ^udp[[:space:]] |\
grep :${queryport}[[:space:]] | rev | awk '{print $1}' |\ grep :${queryport}[[:space:]] | rev | awk '{print $1}' |\
@ -264,7 +262,7 @@ fn_stop_ark(){
pid=${pid//[!0-9]/} pid=${pid//[!0-9]/}
let pid+=0 # turns an empty string into a valid number, '0', let pid+=0 # turns an empty string into a valid number, '0',
# and a valid numeric pid remains unchanged. # and a valid numeric pid remains unchanged.
if [[ ${pid} -gt 1 && $pid -le $(cat /proc/sys/kernel/pid_max) ]] ; then if [ "${pid}" -gt 1 && "${pid}" -le $(cat /proc/sys/kernel/pid_max) ]; then
fn_print_dots "Process still bound. Awaiting graceful exit: ${pidcheck}" fn_print_dots "Process still bound. Awaiting graceful exit: ${pidcheck}"
sleep 1 sleep 1
else else
@ -275,7 +273,7 @@ fn_stop_ark(){
# The process doesn't want to close after 20 seconds. # The process doesn't want to close after 20 seconds.
# kill it hard. # kill it hard.
fn_print_error "Terminating reluctant Ark process: ${pid}" fn_print_error "Terminating reluctant Ark process: ${pid}"
kill -9 $pid kill -9 ${pid}
fi fi
fi # end if for port check fi # end if for port check
} # end of fn_stop_ark } # end of fn_stop_ark
@ -330,7 +328,6 @@ fn_stop_tmux(){
# Make certain the ports are cleared before continuing. # Make certain the ports are cleared before continuing.
if [ "${gamename}" == "ARK: Survival Evolved" ]; then if [ "${gamename}" == "ARK: Survival Evolved" ]; then
fn_stop_ark fn_stop_ark
echo -en "\n"
fi fi
fn_print_ok_nl "${servername}" fn_print_ok_nl "${servername}"
fn_script_log_pass "Stopped ${servername}" fn_script_log_pass "Stopped ${servername}"

Loading…
Cancel
Save