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

arkmanager update --check --update-mods --ifempty #517

Closed NLBlackEagle closed 6 years ago

NLBlackEagle commented 8 years ago

The title already suggest what I want to ask with this "Issue" Is there any way ( Using crontab -e for linux ) to auto update the server only when a update is available & only when the server doesnt has any players connected.

I would really love to have this crontab job run every single minute to make sure everyone is able to connect at all times.

Thanks in advance!

klightspeed commented 8 years ago

If you have arkStagingDir set, then arkmanager update --update-mods --ifempty will:

Note that checking for updates every minute is likely too frequent.

NLBlackEagle commented 8 years ago

Thanks for the fast response, however doesnt the "arkStagingDir" requires this command to actually download the update/mod: --downloadonly?

So, the conclusion would be:

arkmanager update --downloadonly ( Each 10 minutes or so ) arkmanager update --update-mods --ifempty ( Each 5 minutes or so )

And if so, wouldnt that cause a bigger load on the server then nessesairy?

klightspeed commented 8 years ago

No - --downloadonly is not required when using arkStagingDir. The --downloadonly option only skips the update application stage.

NLBlackEagle commented 8 years ago

Thanks for the answer, however when using the arkmanager update --update-mods --ifempty is says "Update already in progress" At first I tought this was due to the fact it runs every single minute and therefor gets stuck at updating since it doesnt gets the time to restart and fully update.

All I would like to know this time if this is correct, since if it is I will simply change it to run the command every 15 minutes allowing it enough time to run the update and restart.

( I've run into another issue: it's telling me that 0 players are still connected )

klightspeed commented 8 years ago

It will say Update already in progress if there is already an arkmanager update process running. Depending on how many mods you have installed, it can take several minutes for an update check to run when using --update-mods, as steamcmd provides no way of determining whether a mod has been updated without executing a workshop_download_item.

( I've run into another issue: it's telling me that 0 players are still connected )

There's a typo in 1.5, which is fixed in the 1.6-dev channel.

klightspeed commented 8 years ago

The 0 players still connected should be fixed.

NLBlackEagle commented 8 years ago

Thanks for the fix! However, does the following command:

arkmanager update --update-mods --ifempty

also support mods, as in checking if there is a update for a mod?

And if so, would the following line:

arkmanager update --update-mods --warn

do this:

Check if an update is necessary
If an update is necessary then it will download the update.
Once the update is downloaded, it will warn everyone at 5 and 15 minutes beforehand.
One everyone is warned it will stop the game server, apply the update, then restart the server.
klightspeed commented 8 years ago

Thanks for the fix! However, does the following command:

arkmanager update --update-mods --ifempty

also support mods, as in checking if there is a update for a mod?

That command will download updates for all of the mods, and if arkStagingDir is set it will also download an update for the server. If an update is available and nobody is connected to the server, then it will apply the update(s).

And if so, would the following line:

arkmanager update --update-mods --warn
  • Check if an update is necessary
  • If an update is necessary then it will download the update.
  • Once the update is downloaded, it will warn everyone at 5 and 15 minutes beforehand.
  • One everyone is warned it will stop the game server, apply the update, then restart the server.

As I said before, with mods there is no way of checking if an update is available without trying to download the mod. However, yes, that is basically what that command will do.

NLBlackEagle commented 8 years ago

Works all the same though, like a charm :) ArkManager warned me about 10 minutes before hand that there was a update available, when it closed it updated the mod and started up again. On top of that, the moment I logged off and restarted the game the server was already up and running :)

:+1: for you guys, you did an amazing job! Aint going to miss the missmatch errors haha

ManyStrongWords commented 8 years ago

Sorry for bringing this back up but running this updates mods and ark itself? (arkmanager update --update-mods --warn) Also how often do you run it and how do i setup a staging directory or would i need it?

NLBlackEagle commented 8 years ago

@GovicMEW

Your lucky I was getting harrased by some thread spam and went on github to check similar threads haha, otherwise It could've taken quite some time for me to notice.

arkmanager update --update-mods --warn

Anyway, if you have linux open up the terminal ( putty for example ) and type: crontab -e

scroll all the way down and press insert, then enter to create a new line, also offtopic but verry usefull add this line:

@reboot arkmanager start The above line will start arkmanager when the server reboots without you being around. I use this for all the gameservers installed on the dedicated server & teamspeak :)

then, to the arkmanager --update-mods --warn: I use 2 command lines of witch one takes place every 15 minutes & the other every day on 6 o clock:

*/15 * * * * /usr/local/bin/arkmanager update --warn --saveworld --update-mods 0 6 * * * /usr/local/bin/arkmanager update --warn --saveworld --update-mods

The top line is for 15 minutes, the bottom line for 6 o clock every day.

Note: If you want to change the warn messages open up etc/arkmanager/arkmanager.cfg The message lines are listed below: # Update warning messages Also check out: arkwarnminutes="60" to alter the warning execute period :)

Ark Staging Dir:

The Ark Staging Dir is a folder which saves ark updates prior to updating the server core files itself, with this you dont have to deal with extended offline periods as when the server executes a update ( using the arkmanager update --update-mods --warn command )it copies the file over instead doing a full download. In fact, when my server does a update it's up within 1 minute and 30 seconds! Without the ark staging dir it takes 10-15 minutes ;)

Anyway, to set this up go to /etc/arkmanager/arkmanager.cfg and look for "arkStagingDir=" I recommend you use a path close to the ark steam files as copying will be faster. ( Instead from drive a to drive b ) Here's what I have set:

arkStagingDir="/home/steam/ARK-Staging"

Also make sure you remove the # in front of the line!

I've tried my best to give as much info as possibile, I hope this anwsers your questions :)

( P.S. I also highly recommend using this line: arkBackupPreUpdate="true" It will save you alot of trouble when things go wrong )

ManyStrongWords commented 8 years ago

@NLBlackEagle Thank you for this message as it is very helpful. One more question I have is why do you run the command at 6 o'clock if it is the same one running every 15 minutes? Is that a standard time for ARK updates? Also does this bring the server back up or do I add another cron job to do that?

NLBlackEagle commented 8 years ago

The @reboot line brings the server backup, the 6 o clock line is something i did as insurance & to give the server a fresh start which keeps the server performance on a stable level.

NLBlackEagle commented 8 years ago

So in total 3 lines :)

ManyStrongWords commented 8 years ago

I don't have arkStagingDir in my config, is it by chance AltSaveDirectoryName or should I add arkStagingDir into it? Do I just add this to the end of the update commands in the cron tab? --stagingdir=

klightspeed commented 8 years ago

arkStagingDir is the option you want if you want to download updates before restarting the server - set it to the directory in which you want to stage updates.

ark_AltSaveDirectoryName just sets an alternative save directory name other than SavedArks.

ManyStrongWords commented 8 years ago

So i can add arkStagingDir="/home/steam/ARK-Staging" Into my config file even though it doesn't currently exist in it. Correct?

klightspeed commented 8 years ago

Correct. See your /etc/arkmanager/arkmanager.cfg.NEW file

Samsonetty commented 4 years ago

Hello, I also have a question, I have already installed an Ark server with your instructions, this one runs perfect since 2016, now I got a new root server with more power, and installed Ark here, this one also runs perfect, but I probably have a problem with the created cron, he does the restart, but the backups are missing somehow, can you tell me where in line 34 / start 43 the @all has to go, so he also does the backup? Sorry my English is not so good, translated with Deepl:0 23 /usr/local/bin/arkmanager backup 45 4 /usr/local/bin/arkmanager broadcast "Restart in 15 minutes" 50 4 /usr/local/bin/arkmanager broadcast "Restart in 10 minutes" 55 4 /usr/local/bin/arkmanager broadcast "Restart in 5 minutes" 59 4 /usr/local/bin/arkmanager broadcast "Restart in 1 minute" 0 5 * /usr/local/bin/arkmanager restart @all

43 * /usr/local/bin/arkmanager update --update-mods --backup --warn --saveworld > autoupdate.log