arkmanager / ark-server-tools

Set of server tools used to manage ARK: Survival Evolved servers on Linux
MIT License
678 stars 143 forks source link

Simultaneous Update with Cron and or failed script attempt #1202

Open Haidies-AU opened 2 years ago

Haidies-AU commented 2 years ago

I have 10 instances clustered together running from one arkserverroot and one staging folder. each instance has its own CPU affinities, ports and save directories etc everything works

my issue is, when I use cron to run arkmanager update @all --update-mods --warn each instance will update 1 after the other which is 100 mintues before the last instance finally starts updating.

All I really want is to check for any server or mod updates then if there are any do a 10 minute countdown, update the install and restart all the instances all at once.

After finally noticing a typo in my cronjob's im trying updating all the instances individually.

Haidies-AU commented 2 years ago

the line of thought Im trying to figure out is

if [Server or mods need update = true] then download updates to staging broadcast countdown every minute for 10 minutes shutdown all instances and apply update restart log update success else log checked and did nothing fi

Made an attempt below but it dosnt work

Haidies-AU commented 2 years ago

!/bin/bash

Game=0 Mods=0 Need=0 Empty=0 Log=log_file.txt

if arkmanager checkupdate @Genesis2; then Game=0 else Game=1 fi

if arkmanager checkmodupdate @Genesis2; then Mods=1 else Mods=0 fi

Need=$(($Game + $Mods))

if [ $Need -eq $Empty ]; then date=$(date) echo "Update checked $date Game=$game Mods=$mod Need=$Need" >> $Log else arkmanager update @Genesis2 --update-mods --downloadonly arkmanager broadcast @all "The Ark Server will shutdown for an Update in 10 Minutes" sleep 60 arkmanager broadcast @all "The Ark Server will shutdown for an Update in 9 Minutes" sleep 60 arkmanager broadcast @all "The Ark Server will shutdown for an Update in 8 Minutes" sleep 60 arkmanager broadcast @all "The Ark Server will shutdown for an Update in 7 Minutes" sleep 60 arkmanager broadcast @all "The Ark Server will shutdown for an Update in 6 Minutes" sleep 60 arkmanager broadcast @all "The Ark Server will shutdown for an Update in 5 Minutes" sleep 60 arkmanager broadcast @all "The Ark Server will shutdown for an Update in 4 Minutes" sleep 60 arkmanager broadcast @all "The Ark Server will shutdown for an Update in 3 Minutes" sleep 60 arkmanager broadcast @all "The Ark Server will shutdown for an Update in 2 Minutes" sleep 60 arkmanager broadcast @all "The Ark Server will shutdown for an Update in 1 Minutes" sleep 60 arkmanager update @all --update-mods --no-download --saveworld date=$(date) echo "Servers Updated $date" >> $Log fi

Haidies-AU commented 2 years ago

any form of feedback would be appreciated, I know its probably blaringly obvious to someone somewhere.

fusselshu commented 2 years ago

I ran into the same "problem" a while ago aswell. My solution was adding a cronjob for each Server so the countdown delaying the other server 1 by 1 wont happen. Also if you dont want them to update at the same exact time, which will stress the Host Machine, just create a .sh for each instance with a sleep timer infront of like 30secs more each file. For example first file sleep 0 second sleep 30 third sleep 60 and so on. You just need to tinker around how fast your server is with updating, so you can reduce the sleep timer infront of the initial update command :)