mirror of
https://github.com/YuzuZensai/palworld-server-docker.git
synced 2026-01-06 04:32:43 +00:00
35 lines
784 B
Bash
35 lines
784 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 /home/steam/
|
|
|
|
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
|
|
}
|
|
|
|
if [ "${BACKUP_ENABLED}" = true ]; then
|
|
service cron start
|
|
fi
|
|
|
|
trap 'term_handler' SIGTERM
|
|
|
|
su steam -c ./start.sh &
|
|
# Process ID of su
|
|
killpid="$!"
|
|
wait $killpid
|