2024-01-20 22:08:00 -08:00
|
|
|
#!/bin/bash
|
2024-01-19 19:35:32 +01:00
|
|
|
|
2024-01-20 22:08:00 -08:00
|
|
|
if [[ ! "${PUID}" -eq 0 ]] && [[ ! "${PGID}" -eq 0 ]]; then
|
2024-01-21 16:24:31 +01:00
|
|
|
printf "\e[0;32m*****EXECUTING USERMOD*****\e[0m\n"
|
2024-01-20 22:08:00 -08:00
|
|
|
usermod -o -u "${PUID}" steam
|
|
|
|
|
groupmod -o -g "${PGID}" steam
|
|
|
|
|
else
|
2024-01-21 16:24:31 +01:00
|
|
|
printf "\033[31mRunning as root is not supported, please fix your PUID and PGID!\n"
|
2024-01-20 22:08:00 -08:00
|
|
|
exit 1
|
|
|
|
|
fi
|
2024-01-19 14:58:51 +01:00
|
|
|
|
2024-01-24 18:10:24 +07:00
|
|
|
mkdir -p /palworld/backups
|
2024-01-27 19:49:43 -05:00
|
|
|
chown -R steam:steam /palworld /home/steam/
|
2024-01-19 14:58:51 +01:00
|
|
|
|
2024-01-24 18:25:12 -05:00
|
|
|
term_handler() {
|
2024-01-25 18:23:14 +01:00
|
|
|
if [ "${RCON_ENABLED}" = true ]; then
|
2024-01-24 19:00:25 -05:00
|
|
|
rcon-cli save
|
2024-01-26 11:50:31 -08:00
|
|
|
rcon-cli "shutdown 1"
|
2024-01-24 19:08:04 -05:00
|
|
|
else # Does not save
|
2024-01-25 18:23:14 +01:00
|
|
|
kill -SIGTERM "$(pidof PalServer-Linux-Test)"
|
2024-01-24 18:44:15 -05:00
|
|
|
fi
|
2024-01-24 19:00:25 -05:00
|
|
|
tail --pid=$killpid -f 2>/dev/null
|
2024-01-24 18:25:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trap 'term_handler' SIGTERM
|
|
|
|
|
|
2024-01-27 19:49:43 -05:00
|
|
|
su steam -c ./start.sh &
|
|
|
|
|
# Process ID of su
|
2024-01-24 18:25:12 -05:00
|
|
|
killpid="$!"
|
|
|
|
|
wait $killpid
|