Files
palworld-server-docker/scripts/init.sh
Odaka Ui d4ed4b70a3 Add quotes around shutdown 1
`gorcon/rcon-cli` treats space separated arguments as separate commands.
Adding quotes around `rcon-cli "shutdown 1"`, forces rcon-cli to treat
it as a single command.
2024-01-26 12:00:20 -08:00

35 lines
913 B
Bash

#!/bin/bash
if [[ ! "${PUID}" -eq 0 ]] && [[ ! "${PGID}" -eq 0 ]]; then
printf "\e[0;32m*****EXECUTING USERMOD*****\e[0m\n"
usermod -o -u "${PUID}" steam
groupmod -o -g "${PGID}" steam
else
printf "\033[31mRunning as root is not supported, please fix your PUID and PGID!\n"
exit 1
fi
mkdir -p /palworld/backups
chown -R steam:steam /palworld
if [ "${UPDATE_ON_BOOT}" = true ]; then
printf "\e[0;32m*****STARTING INSTALL/UPDATE*****\e[0m\n"
su steam -c '/home/steam/steamcmd/steamcmd.sh +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit'
fi
term_handler() {
if [ "${RCON_ENABLED}" = true ]; then
rcon-cli save
rcon-cli "shutdown 1"
else # Does not save
kill -SIGTERM "$(pidof PalServer-Linux-Test)"
fi
tail --pid=$killpid -f 2>/dev/null
}
trap 'term_handler' SIGTERM
./start.sh &
killpid="$!"
wait $killpid