gameservergame-servergame-servershacktoberfestdedicated-game-serversgamelinuxgsmserverbashgaminglinuxmultiplayer-game-servershell
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1014 B
30 lines
1014 B
#!/bin/bash
|
|
# LinuxGSM command_restart.sh module
|
|
# Author: Daniel Gibbs
|
|
# Contributors: https://linuxgsm.com/contrib
|
|
# Website: https://linuxgsm.com
|
|
# Description: Restarts the server.
|
|
|
|
commandname="RESTART"
|
|
commandaction="Restarting"
|
|
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
|
|
fn_firstcommand_set
|
|
|
|
check.sh
|
|
info_game.sh
|
|
check_players_online.sh
|
|
if [ -n "${playersonline}" ]; then
|
|
fn_print_info_nl "${playersonline} players are on the server: restart postponed"
|
|
fn_script_log_info "${playersonline} players are on the server: restart postponed"
|
|
echo "${playersonline}" > "${lockdir:?}/${selfname}-player-numbers.lock"
|
|
date '+%s' > "${lockdir:?}/${selfname}-restart-request.lock"
|
|
core_exit.sh
|
|
fi
|
|
# Clear any pending restart request now that the restart is actually proceeding,
|
|
# so a stale lock doesn't trigger a repeat restart on the next monitor run.
|
|
rm -f "${lockdir:?}/${selfname}-restart-request.lock"
|
|
exitbypass=1
|
|
command_stop.sh
|
|
command_start.sh
|
|
fn_firstcommand_reset
|
|
core_exit.sh
|
|
|