diff --git a/tools/arkmanager b/tools/arkmanager index 80fa4a3..76984f9 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -338,6 +338,21 @@ doStart() { fi } +# +# starts all servers specified by configfile_xxxxx in config file +# +doStartAll(){ + doStart + for cfg in "${!configfile_@}"; do + if [ -f "${!cfg}" ]; then + ( + source "${!cfg}" + doStart + ) + fi + done +} + # # stop the ARK server # @@ -371,6 +386,21 @@ doStop() { fi } +# +# stops all servers specified by configfile_xxxxx in config file +# +doStopAll(){ + doStop + for cfg in "${!configfile_@}"; do + if [ -f "${!cfg}" ]; then + ( + source "${!cfg}" + doStop + ) + fi + done +} + # # install of ARK server # @@ -718,16 +748,35 @@ checkConfig while true; do case "$1" in start) - doStart + if [ "$2" == "--all" ]; then + doStartAll + shift + else + doStart + fi ;; stop) - doStop + if [ "$2" == "--all" ]; then + doStopAll + shift + else + doStop + fi ;; restart) - doStop + if [ "$2" == "--all" ]; then + doStopAll + else + doStop + fi echo "`timestamp`: stop" >> "$logdir/$arkmanagerLog" sleep 1 - doStart + if [ "$2" == "--all" ]; then + doStartAll + shift + else + doStart + fi echo "`timestamp`: start" >> "$logdir/$arkmanagerLog" echo "`timestamp`: restart" >> "$logdir/$arkmanagerLog" ;; @@ -786,8 +835,11 @@ while true; do echo "checkupdate Check for a new ARK server version" echo "install Install the ARK server files from steamcmd" echo "restart Stops the server and then starts it" + echo "restart --all Restarts all servers specified in configfile_xxxxx" echo "start Starts the server" + echo "start --all Starts all servers specified in configfile_xxxxx" echo "stop Stops the server" + echo "stop --all Stops all servers specified in configfile_xxxxx" echo "status Returns the status of the current ARK server instance" echo "update Check for a new ARK server version, if needed, stops the server, updates it, and starts it again" echo "update --force Apply update without check the current version" diff --git a/tools/arkmanager.cfg b/tools/arkmanager.cfg index 459c543..6bba610 100644 --- a/tools/arkmanager.cfg +++ b/tools/arkmanager.cfg @@ -36,4 +36,4 @@ mod_appid=346110 # App ID for # alternate configs # example for config name "ark1": -#config_ark1="/path/to/config/file" +#configfile_ark1="/path/to/config/file"