/ark-server-tools

Set of server tools used to manage ARK: Survival Evolved servers on Linux

Primary LanguageShellMIT LicenseMIT

ARK: Survival Evolved Linux Server Tools

This tool allows you to manage any ARK: Survival Evolved linux server without having to remember long commands. It provides a lot of features, to get the full list check the Usage section.

Installation

Prerequisites

ARK Server Tools requires certain packages be installed in order to function correctly.

If running under CentOS or RHEL, you will need the following packages installed:

perl-Compress-Zlib
curl
lsof
glibc.i686
libstdc++.i686
bzip2

If running under Debian or Ubuntu, you will need the following packages installed:

perl-modules
curl
lsof
libc6-i386
lib32gcc1
bzip2

Common prerequisites which should normally already be installed are:

>=bash-4.0
>=coreutils-7.6
findutils
perl
rsync
sed
tar

If using CentOS 6 or earlier, or Debian 7 or earlier, you will need to compile a newer version of glibc. See https://github.com/FezVrasta/ark-server-tools/wiki/Install-of-required-versions-of-glibc-and-gcc-on-RHEL-CentOS

To use ARK Server Tools, you will need to install SteamCMD following this guide:

We assume you have created the steam user to store steamcmd and your ARK server.

Requirements

To allow your ARK server to communicate with the outside you have to open some ports in your firewall:

iptables -I INPUT -p udp --dport 27016 -j ACCEPT
iptables -I INPUT -p tcp --dport 27016 -j ACCEPT
iptables -I INPUT -p udp --dport 7778 -j ACCEPT
iptables -I INPUT -p tcp --dport 7778 -j ACCEPT
iptables -I INPUT -p tcp --dport 32330 -j ACCEPT

NB: Change the ports according to the ones set in your arkmanager.cfg file.

Install ARK Server Tools

To install ARK Server Tools run this command:

curl -sL http://git.io/vtf5N | sudo bash -s steam

NB: You may want to change the bash -s parameter to fit your steam user if different from steam.

This will copy the arkmanager script and its daemon to the proper directories and will create an empty log directory in /var/log for ARK Server Tools.

To instead perform a user-install of ARK Server Tools as an unprivileged user, run this command:

curl -sL http://git.io/vtf5N | bash -s -- --me

Configuration

Stored in /etc/arkmanager/arkmanager.cfg and /etc/arkmanager/instances/<instancename>.cfg you can find the variables needed to start the server, like the port numbers, the system environment variables and so on.

You will need to modify these files with any options you wish to give to the server, and any paths that are non-standard in your environment (e.g. one common one is the path to the appinfo cache).

See Configuration files for options.

Also, in these files, you can specify any parameter you want to add to the startup command of ARK server. These parameters must be prefixed by the ark_ string, some example could be:

ark_SessionName="My ARK server"
ark_MaxPlayers=50
ark_ServerPVE=False
ark_DifficultyOffset=1

Your session name may not contain special characters (eg. !![EU]!! Aw&some ARK) as it could break the startup command. In this case you may want to comment out the ark_SessionName variable and define it inside your GameUserSettings.ini file instead.

To specify an option without an argument (e.g. bRawSockets), specify an empty argument (e.g. ark_bRawSockets="").

To specify a dash-option without an argument (e.g. -log), add the option="" prefixed with arkflag_ (e.g. arkflag_log="").

To specify a dash-option with an argument (e.g. -StructureDestructionTag=DestroySwampSnowStructures), add the option=value prefixed with arkopt_ (e.g. arkopt_StructureDestructionTag=DestroySwampSnowStructures).

You can override or add variables for a specific system user creating a file called .arkmanager.cfg in the home directory of the system user.

Each server instance must have its own set of ports. These ports are specified using the ark_Port, ark_QueryPort and ark_RCONPort settings in the instance configuration. If the QueryPort or Port settings are shared between multiple instances, then the server will often either crash or hang without being able to be queried. If the RCONPort setting is shared between multiple instances, the server will hang at 0/0 players.

See Configuration files for more options.

Install ARK Server

To install ARK Server just run this command as normal user:

arkmanager install

Usage

arkmanager [Global Options] <command> [Command Options] [Command Args] [Instances]

Global Options

--help

Prints some help on using the command

--version

Prints the arkmanager version

Common Options

--verbose

Exposes the output of SteamCMD

--dots

Prints dots for progress

--spinner

Uses a spinner for progress

Instanceless commands

upgrade-tools

Upgrades the ARK server tools to the latest version

uninstall-tools

Uninstalls the ARK server tools

list-instances

Lists the available instances

--brief

prints a single line with just the instance names

useconfig

Legacy command for specifying an instance for the following command(s)

remove-mods

Remove the specified mods from the steamcmd workshop directory

Commands acting on instances

All of the following commands take @instancename arguments to specify one or more instances, with the special @all instance selecting all instances.

run

Runs the server without putting it into the background

start

Runs the server and puts it into the background

--noautoupdate

Disables automatic updating on startup if it is enabled

--alwaysrestart

Enable automatically restarting the server even if it crashes without becoming ready for player connections.

stop

Stops the server if it is running

--warn

Warns any connected players that the server is going down

--warnreason

Gives a reason for the shutdown. Defaults to maintenance

--saveworld

Saves the world using saveworld - usually not necessary, as server usually saves the world on a graceful shutdown

restart

Runs the stop command followed by the restart command. Accepts and passes the options for those commands

--warnreason

Gives a reason for the restart. Defaults to a restart

install

Downloads and installs (or validates an existing install) of the ARK server

update

Updates an install of the ARK server (or installs it if it’s not already installed)

--force

Bypasses the check for if an update is available

--safe

Only shuts down the server when the server has saved in the past minute

--warn

Warns any connected players that the server is going down for an update

--ifempty

Only updates the server when nobody is connected

--validate

Re-validates the ARK server install

--saveworld

Saves the world using saveworld - usually not necessary, as server usually saves the world on a graceful shutdown

--update-mods

Updates any installed mods

--backup

Backs up the saved world and game config before updating

--stagingdir=<dir>

Sets the staging directory in order to download the update before shutting down the server

--downloadonly

Downloads the update but does not apply it. Only has effect if a staging directory is set.

cancelshutdown

Cancels a pending update / shutdown / restart that was run with the --warn option

checkupdate

Checks if an ARK server update is available

checkmodupdate

Checks if any mods need updating on the server

--revstatus

Reverses the exit code, and adds extra codes for failures

Exit status
  • 0: An update is available, or workshop files are missing

  • 1: No update is available

  • 2: One or more mods is missing from the workshop

Reversed status codes
  • 0: No update is avaibale

  • 1: An update is available

  • 2: One or more mods is missing from the workshop

  • 3: appworkshop_346110.acf is missing

  • 4: SteamCMD workshop dir does not exist

installmods

Installs all mods specified in the instance config into the ShooterGame/Content/Mods directory

uninstallmods

Deletes all mods from the ShooterGame/Content/Mods directory

installmod <modnum>[,<modnum>[,…​]]

Installs the specified mods into the ShooterGame/Content/Mods directory

uninstallmod <modnum>[,<modnum>[,…​]]

Deletes the specified mods from the ShooterGame/Content/Mods directory

removemod <modnum>[,<modnum>[,…​]]

Deletes the specified mods from the SteamCMD workshop directory

reinstallmod <modnum>[,<modnum>[,…​]]

Runs the uninstallmod command followed by the installmod command

enablemod <modnum>
enablemod <modnum>=<modtype>

Enables the arkmod_<modnum> setting in the instance config. modtype defaults to game. Mod types:

game

A mod in GameModIds

map

The MapModId mod

tc
totalconversion

The TotalConversionMod mod

backup

Backs up the saved world and game config files to a compressed tar file in the backups directory specified in the config

broadcast "message"

Broadcasts a message to players connected to the server using the RCON broadcast command

saveworld

Saves the world using the RCON saveworld command

rconcmd "command"

Sends the specified RCON command to the server and prints its response

status

Prints the status of the ARK server

install-cronjob <command>

Installs a cron job that executes the specified command. This accepts any of the options the specified command accepts, as well as the following options. In order to specify an argument to the command (e.g. to the broadcast command), use the --arg=<arg> option. Please read your man 5 crontab manpage to determine what minute and hour values are valid, as some implementations may not accept e.g. the */n minute / hour specification.

--daily

The command should be executed daily

--hourly

The command should be executed hourly

--hour=<hour>

Specifies one or more hours when the command should execute. This is the hour field of the cron job. If you want to have the command execute every n hours, then use --hour='/n' Default: (i.e. all hours)

--minute=<minute>

Specifies one or more minutes of the hour when the command should execute. This is the minute field of the cron job. If you want to have the command execute every n minutes, then use --minute='*/n' Default: 0 (i.e. the first minute of the hour)

--enable-output

Enables the output from the command - the cron daemon usually emails this to the user specified in the cron configuration

--arg=<arg>

Specifies an argument to pass to the command

remove-cronjob <command>

Removes a cron job previously installed by install-cronjob

Configuration files

Global configuration

Global configuration is stored in /etc/arkmanager/arkmanager.cfg and/or ~/.arkmanager.cfg.

The following options cannot be overridden in the instance config files:

arkstChannel

Specifies the release channel (git branch) to use when upgrading the ARK server tools

install_bindir
install_libexecdir
install_datadir

Set by the installer to specify where to install the executable and data files

configfile_<name>

Paths to the specified instance config files

defaultinstance

The default instance to use if no instance is specified

steamcmd_user

The user under which the tools should be run. Set to --me in ~/.arkmanager.cfg in the case of a user-install

The following options can be overridden on a per-instance basis:

steamcmdroot

The directory in which SteamCMD is installed

steamcmdexec

The steamcmd.sh executable

steamcmd_appinfocache

The path to the Steam appinfo cache file. Most systems will have this in $HOME/Steam/appcache/appinfo.vdf, but some systems have this instead in $HOME/.steam/appcache/appinfo.vdf. You will need to modify this setting if this is the case.

steamcmd_workshoplog

The path to the Steam workshop log file. Most systems will have this in $HOME/Steam/logs/workshop_log.txt, but some systems have this instead in $HOME/.steam/logs/workshop_log.txt. You will need to modify this setting if this is the case.

steamdataroot

   The path to the SteamCMD data.    Defaults to $steamcmdroot    Some SteamCMD installations store downloaded files (workshop    files, etc.) in /home/.steam instead of in the steamcmd    directory.

steamworkshopdir

The path to the SteamCMD workshop directory. Defaults to $steamdataroot/steamapps/workshop Some SteamCMD installations use SteamApps as the steamapps directory instead of steamapps

arkserverexec

The relative path within an ARK server install where the ARK server executable can be found. For the standard ARK server, this should be ShooterGame/Binaries/Linux/ShooterGameServer

arkbackupdir

The directory in which to store backups. Can be overridden in the instance config.

arkwarnminutes

The number of minutes over which the shutdown and update warnings should be run

arkautorestartfile

The relative path within an ARK server install to place the autorestart lock file

arkAlwaysRestartOnCrash

Set to true to enable automatically restarting even when the server has not become ready for player connections. Be aware that this may cause the server to enter an endless crash-restart loop if the cause of the crash is not resolved.

arkAutoUpdateOnStart

Set to true to enable updating before server startup

arkBackupPreUpdate

Set to true to enable automatic backups before updating

arkStagingDir

Sets the staging directory in order to download updates before shutting down the server

arkMaxBackupSizeMB

Limits the size of the stored backups

arkPriorityBoost

Attempts to boost the priority of the ARK server. Negative values give a higher priority, and positive values give a lower priority. Requires sudo and renice

arkCpuAffinity

Attempts to set the CPU affinity of the ARK server. Setting is a comma-delimited list of processor indices on which the server should run. Requires sudo and taskset

msgWarnUpdateMinutes
msgWarnUpdateSeconds
msgWarnRestartMinutes
msgWarnRestartSeconds
msgWarnShutdownMinutes
msgWarnShutdownSeconds

Templated messages for warnings, where %d is replaced with the number of minutes / seconds before the update / restart / shutdown

msgWarnReason
msgTimeMinutes
msgTimeSeconds
msgReasonUpdateApp
msgReasonUpdateMod
msgReasonUpdateAppMod
msgReasonRestart
msgReasonShutdown

Alternative templated messages for warnings with the following replacement parameters:

{reason}

Valid in msgWarnReason, replaced at runtime with the appropriate msgReason* template

{time}

Valid in msgWarnReason and msgReason*, replaced at runtime with the appropriate msgTime* template

{modnamesupdated}

Valid in msgReason*Mod, replaced at runtime with a comma-delimited list of updated mod names

{minutes}

Valid in msgTimeMinutes, replaced at runtime with minutes remaining until shutdown

{seconds}

Valid in msgTimeSeconds, replaced at runtime with seconds remaining until shutdown

logdir

Specifies where to store log files

appid

The Steam AppID of the ARK server

mod_appid

The Steam AppID of the ARK client (used for downloading mods)

mod_branch

The Mod branch (Windows or Linux) to use. Virtually all mods use the Windows branch for the ARK server, and the Linux branch almost always crashes the server

ARK server options:

serverMap

The map the server should use

serverMapModId

Uses the -MapModID=<modid>?…​ option to specify the server map mod ID

ark_<optname>="<optval>"

Specifies the options to use in the Map?Option=Val?…​ option string passed to the server

ark_<optname>=""

Specifies an option without a value - Map?Option?…​

arkflag_<optname>=<anything>

Specifies a dash-option without a value (i.e. flag) - e.g. arkflag_DisableDeathSpectator=true adds the -DisableDeathSpectator flag

arkopt_<optname>="<optval>"

Specifies a dash-option with a value - e.g. arkopt_StructureDestructionTag=DestroySwampSnowStructures adds the -StructureDestructionTag=DestroySwampSnowStructures option.

Instance config files

Instance config files are stored under /etc/arkmanager/instances/<instancename>.cfg, ~/.config/arkmanager/instances/<instancename>.cfg or as specified in the configfile_<instancename> options in the global config.

arkserverroot

The directory under which the ARK server is installed

serverMap

The map the server should use

serverMapModId

Uses the -MapModID=<modid>?…​ option to specify the server map mod ID

ark_<optname>="<optval>"

Specifies the options to use in the Map?Option=Val?…​ option string passed to the server

ark_<optname>=""

Specifies an option without a value - Map?Option?…​

arkflag_<optname>=<anything>

Specifies a dash-option without a value (i.e. flag) - e.g. arkflag_DisableDeathSpectator=true adds the -DisableDeathSpectator flag

arkopt_<optname>="<optval>"

Specifies a dash-option with a value - e.g. arkopt_StructureDestructionTag=DestroySwampSnowStructures adds the -StructureDestructionTag=DestroySwampSnowStructures option.

arkmod_<modnum>=<modtype>

Specifies a mod that can be enabled or disabled using enablemod and disablemod. Note that mod ids specified using these options are in addition to those specified directly in the ark_GameModIds option, and override those specified in the ark_MapModId, serverMapMod and ark_TotalConversionMod options. Options are processed in the order they are specified in the instance config file, and arkmod_* options in the common config file are not applied. Mod types:

game

A mod to be specified in GameModIds

map

The mod to be specified in MapModId

tc
totalconversion

The mod to be specified in TotalConversionMod

disabled

A disabled mod

Common ARK options

ark_TotalConversionId=<modid>

Specifies the Total Conversion to use

ark_GameModIds=<modid>,<modid>,…​

Specifies the Mod IDs to use

ark_SessionName="<sessionname>"

The name under which the server should announce itself

ark_RCONEnabled="True"

Enabled RCON

ark_RCONPort=<portnum>

The port on which the server listens for RCON commands. Must be unique on the host.

ark_Port=<portnum>

The port on which the server listens for client connections. Must be unique on the host.

ark_QueryPort=<portnum>

The port on which the server listens for queries. Must be unique on the host.

ark_ServerPassword="<password>"

Specifies the password needed to connect to the server

ark_ServerAdminPassword="<password>"

Specifies the server admin password, which is also the RCON password. Use of this option is discouraged - please store the password in the GameUserSettings.ini file instead.

ark_MaxPlayers=<numplayers>

The maximum number of players allowed to connect to the server

ark_AltSaveDirectoryName="<dirname>"

Alternative directory under ShooterGame/Saved under which to save the world files. If multiple instances run from the same directory, this must be unique between these instances.

arkflag_NoBattlEye=true

Disables BattlEye