arkmanager / ark-server-tools

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

bug checking online players before update #1158

Closed discept closed 3 years ago

discept commented 3 years ago

Greetings,

I am experiencing some problems updating arkmanager by using --ifempty and/or --warn parameter. OS: Ubuntu 18.04.5 LTS arkstTag='v1.6.56'

Crontab entry: */30 * * * * /usr/local/bin/arkmanager update --warn --saveworld --backup --update-mods @scourgedearth

Output Crontab:

From ark@cl-ts01 Fri Nov 13 09:30:42 2020 Return-Path: ark@cl-ts01 X-Original-To: ark Delivered-To: ark@cl-ts01 Received: by cl-ts01 (Postfix, from userid 1003) id 45424A071A; Fri, 13 Nov 2020 09:30:42 +0100 (CET) From: root@cl-ts01 (Cron Daemon) To: ark@cl-ts01 Subject: Cron ark@cl-ts01 /usr/local/bin/arkmanager update --warn --saveworld --backup --update-mods @scourgedearth MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: Message-Id: 20201113083042.45424A071A@cl-ts01 Date: Fri, 13 Nov 2020 09:30:42 +0100 (CET)

Running command 'update' for instance 'scourgedearth' Checking for update; PID: 1106 Downloading ARK update ... ..........................^H ^HThis ARK server will shutdown for an update in 30 minutes Command processed There are 0 0 players connected /usr/local/bin/arkmanager: line 1852: ((: 0 0: syntax error in expression (error token is "0") There are 0 0 players connected /usr/local/bin/arkmanager: line 1852: ((: 0 0: syntax error in expression (error token is "0") There are 0 0 players connected /usr/local/bin/arkmanager: line 1852: ((: 0 0: syntax error in expression (error token is "0")

It continues til shutdown:

0 players connected /usr/local/bin/arkmanager: line 1899: ((: 0 0: syntax error in expression (error token is "0") This ARK server will shutdown for an update in 15 seconds Command processed This ARK server will shutdown for an update in 10 seconds Command processed This ARK server will shutdown for an update in 5 seconds Command processed Saving world "World Saved " Stopping server; reason: update The server has been stopped [Backup stuff going on...] ^[[0;39m Created Backup: ^[[1;32m scourgedearth.2020-11-13_09.30.33.tar.bz2^[[0;39m Applying update from staging directory Update to 5824456 complete The server is starting... The server is now running, and should be up within 10 minutes

After that the update installed successfully.

The issue ist reproducable executing the command manually, but it only occurs if there are updates to install. I can trigger it by executing stop command with --warn parameter as well.

I already examined the "binary" /usr/local/bin/arkmanager. It seems like every time it checks the amount of online players theres a problem adding 0 to the numplayers variable, so happening while using --ifempty variable: arkmanager_error_2112

Thanks in advance

klightspeed commented 3 years ago

That suggests that numPlayersConnected is printing 0 twice - like:

$ echo $(( $(printf '0\n0') + 0 ))
bash: 0
0 + 0 : syntax error in expression (error token is "0 + 0 ")

Could you please try the following:

From your symptoms, that should look like:

ark@cl-ts01:~$ bash
ark@cl-ts01:~$ . /usr/local/bin/arkmanager
ark@cl-ts01:~$ useConfig main
ark@cl-ts01:~$ numPlayersConnected
0
0ark@cl-ts01:~$ echo $(( $(numPlayersConnected) + 0 ))
bash: 0
0 + 0 : syntax error in expression (error token is "0 + 0 ")
ark@cl-ts01:~$
klightspeed commented 3 years ago

I'm guessing you set your server up for crossplay or epic? There was a bug in numPlayersConnected when crossplay or epiconly were enabled. This should be fixed by 5cda461

discept commented 3 years ago

You guessed correctly - its configured for crossplay with epic. Thanks for the fast answer and the fix. I skipped the first steps you described and tested the new version of the arkmanager script immediately. Everything worked fine now so I left you a small gift in hope youll keep up the good work as long as possbile.

Stay healthy and best regards.