mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-12 10:58:28 +00:00
Move start delay to doStart; add pre-start script
This commit is contained in:
parent
f1a90f5c27
commit
abd6c2f02a
@ -1230,6 +1230,16 @@ doStart() {
|
||||
if [ -n "$serverpid" ] && kill -0 "$serverpid"; then
|
||||
logprint "Start aborted due to server already running - pid: $serverpid"
|
||||
else
|
||||
local prestart="${configfile%.cfg}.start"
|
||||
|
||||
if [ -n "${arkPreStart}" ]; then
|
||||
prestart="${arkPreStart}"
|
||||
fi
|
||||
|
||||
if [[ -n "${prestart}" && -f "${prestart}" ]]; then
|
||||
"${prestart}" "$@"
|
||||
fi
|
||||
|
||||
if [ "$arkAutoUpdateOnStart" == "true" ]; then
|
||||
if ! [[ " $* " =~ " --noautoupdate " ]]; then
|
||||
logprint "Checking for updates before starting"
|
||||
@ -1277,6 +1287,20 @@ doStart() {
|
||||
fi
|
||||
tput rc; tput ed;
|
||||
logprint "The server is now running, and should be up within 10 minutes"
|
||||
if [[ -n "$arkStartDelay" || -n "$defaultinstance_max" ]]; then
|
||||
local delay="${arkStartDelay:-${defaultinstance_max}}"
|
||||
if (( "${#instances[@]}" > 1 )); then
|
||||
echo -n "Waiting up to ${delay} seconds before starting next instance "
|
||||
while (( delay > 0 )); do
|
||||
echo -n "."
|
||||
if isTheServerOnline; then
|
||||
break
|
||||
fi
|
||||
(( delay-- ))
|
||||
done
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -3434,20 +3458,6 @@ main(){
|
||||
;;
|
||||
start)
|
||||
doStart "${options[@]}"
|
||||
if [[ ${#instances[@]} > 1 ]]; then
|
||||
COUNTER=0
|
||||
if [ -z "$defaultinstance_max" ]; then
|
||||
defaultinstance_max=0
|
||||
fi
|
||||
while [ $COUNTER -lt $defaultinstance_max ]; do
|
||||
echo -ne "$NORMAL Waiting up to $RED$((defaultinstance_max-COUNTER))$NORMAL seconds before starting next instance."\\r
|
||||
let COUNTER=COUNTER+1
|
||||
if isTheServerOnline ;then
|
||||
break
|
||||
fi
|
||||
sleep 1s
|
||||
done
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
doStop shutdown "${options[@]}"
|
||||
|
||||
@ -18,6 +18,8 @@ arkwarnminutes="60" # number of
|
||||
arkautorestartfile="ShooterGame/Saved/.autorestart" # path to autorestart file
|
||||
arkAutoUpdateOnStart="false" # set this to true if you want to always update before startup
|
||||
arkBackupPreUpdate="false" # set this to true if you want to perform a backup before updating
|
||||
#arkStartDelay=20 # set this to change the maximum delay between server starts - 0 or unser for no delay, will continue immediately when server is up
|
||||
#defaultinstance_max=20 # Same as above, for v1.6.43 compatibility
|
||||
#arkStagingDir="/home/steam/ARK-Staging" # Uncomment to enable updates to be fully downloaded before restarting the server (reduces downtime while updating)
|
||||
|
||||
# Options to automatically remove old backups to keep backup size in check
|
||||
@ -85,4 +87,3 @@ mod_branch=Windows
|
||||
#configfile_ark1="/path/to/config/file"
|
||||
|
||||
defaultinstance="main"
|
||||
defaultinstance_max=20 #The start @all command will wait until this many seconds before starting next instance. If server becomes available it instantly moves to next instance. Enter value of 0 to have no delay.
|
||||
|
||||
@ -25,4 +25,4 @@ ark_MaxPlayers="70"
|
||||
# ARK server options - i.e. for -optname=val, use arkopt_optname=val
|
||||
#arkopt_StructureDestructionTag=DestroySwampSnowStructures
|
||||
|
||||
|
||||
#arkPreStart="/etc/arkmanager/instances/instance.start" # Set this to override the start script; defaults to config file name with .cfg replaced by .start
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user