mirror of
				https://github.com/mbround18/valheim-docker.git
				synced 2021-10-22 21:53:54 +03:00 
			
		
		
		
	| @@ -54,6 +54,7 @@ | ||||
| | MODS                     | ` `                    | FALSE    | This is an array of mods separated by comma and a new line. [Click Here for Examples](./docs/getting_started_with_mods.md) Supported files are `zip`, `dll`, and `cfg`. | | ||||
| | AUTO_UPDATE              | `0`                    | FALSE    | Set to `1` if you want your container to auto update! This means at the times indicated by `AUTO_UPDATE_SCHEDULE` it will check for server updates. If there is an update then the server will be shut down, updated, and brought back online if the server was running before. | | ||||
| | AUTO_UPDATE_SCHEDULE     | `0 1 * * *`            | FALSE    | This works in conjunction with `AUTO_UPDATE` and sets the schedule to which it will run an auto update. [If you need help figuring out a cron schedule click here] | ||||
| | AUTO_UPDATE_PAUSE_WITH_PLAYERS | `0`              | FALSE    | Does not process an update for the server if there are players online. | | ||||
| | AUTO_BACKUP              | `0`                    | FALSE    | Set to `1` to enable auto backups. Backups are stored under `/home/steam/backups` which means you will have to add a volume mount for this directory. | | ||||
| | AUTO_BACKUP_SCHEDULE     | `*/15 * * * *`         | FALSE    | Change to set how frequently you would like the server to backup. [If you need help figuring out a cron schedule click here]. | ||||
| | AUTO_BACKUP_REMOVE_OLD   | `1`                    | FALSE    | Set to `0` to keep all backups or manually manage them. | | ||||
|   | ||||
| @@ -7,6 +7,8 @@ log() { | ||||
|   PREFIX="[Valheim][steam]" | ||||
|   printf "%-16s: %s\n" "${PREFIX}" "$1" | ||||
| } | ||||
|  | ||||
|  | ||||
| if [ "${PUBLIC:=0}" -eq 0 ] && [ "${AUTO_BACKUP_PAUSE_WITH_NO_PLAYERS:=0}" -eq 1 ]; then | ||||
|   log "Woah, cannot pause backup process on a server with PUBLIC=0" | ||||
|   log "This is because we cannot query your server via the Steam API" | ||||
|   | ||||
| @@ -12,11 +12,27 @@ line () { | ||||
|  | ||||
| line | ||||
| log "Valheim Server - $(date)" | ||||
|  | ||||
| cd /home/steam/valheim || exit 1 | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| if odin update --check; then | ||||
|     log "An update is available. Starting the update process..." | ||||
|     if [ "${PUBLIC:=0}" -eq 0 ] && [ "${AUTO_UPDATE_PAUSE_WITH_PLAYERS:=0}" -eq 1 ]; then | ||||
|       log "Woah, cannot pause auto update using AUTO_UPDATE_PAUSE_WITH_PLAYERS on your server with PUBLIC=0" | ||||
|       log "This is because we cannot query your server via the Steam API" | ||||
|     else | ||||
|       if [ "${AUTO_UPDATE_PAUSE_WITH_PLAYERS:=0}" -eq 1 ]; then | ||||
|         export ADDRESS=${ADDRESS:="127.0.0.1:2457"} | ||||
|         NUMBER_OF_PLAYERS=$(DEBUG_MODE=false odin status --address="${ADDRESS}" --json | jq -r '.players') | ||||
|         if [ "${NUMBER_OF_PLAYERS}" -gt 0 ]; then | ||||
|           log "An update is available. Skipping update, while ${NUMBER_OF_PLAYERS} players online...." | ||||
|           exit 0 | ||||
|         fi | ||||
|       fi | ||||
|     fi | ||||
|  | ||||
|     log "An update is available! Beginning update process..." | ||||
|  | ||||
|     # Store if the server is currently running | ||||
|     ! pidof valheim_server.x86_64 > /dev/null | ||||
|   | ||||
| @@ -64,10 +64,12 @@ setup_cron() { | ||||
|  | ||||
|   ADDRESS=${ADDRESS} | ||||
|   PORT=${PORT} | ||||
|   PUBLIC=${PUBLIC} | ||||
|   UPDATE_ON_STARTUP=${UPDATE_ON_STARTUP} | ||||
|   WEBHOOK_URL=${WEBHOOK_URL:-""} | ||||
|  | ||||
|   AUTO_UPDATE=${AUTO_UPDATE} | ||||
|   AUTO_UPDATE_PAUSE_WITH_PLAYERS=${AUTO_UPDATE_PAUSE_WITH_PLAYERS} | ||||
|  | ||||
|   AUTO_BACKUP=${AUTO_BACKUP} | ||||
|   AUTO_BACKUP_REMOVE_OLD=${AUTO_BACKUP_REMOVE_OLD} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Michael
					Michael