feat: Add variables Env for cron feature

This commit is contained in:
Guillaume Barreau
2024-01-25 07:09:30 -05:00
parent 735ae33392
commit 918c32c623
6 changed files with 56 additions and 25 deletions

View File

@@ -1,7 +1,5 @@
#!/bin/bash
printf "\e[0;34m***** RUNNING SCRIPTS start.sh *****\e[0m\n"
STARTCOMMAND="./PalServer.sh"
if [ -n "${PORT}" ]; then
@@ -69,6 +67,21 @@ if [ -n "${RCON_PORT}" ]; then
sed -i "s/RCONPort=[0-9]*/RCONPort=$RCON_PORT/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini
fi
if [[ -n "${BACKUP_ENABLED}" ]]; then
echo "BACKUP_ENABLED=${BACKUP_ENABLED}"
if [[ -z "${BACKUP_CRON_EXPRESSION}" ]]; then
printf "\e[0;31m***** BACKUP_CRON_EXPRESSION NOT SET *****\e[0m\n"
exit 1
else
echo "BACKUP_CRON_EXPRESSION=${BACKUP_CRON_EXPRESSION}"
fi
echo "${BACKUP_CRON_EXPRESSION} root bash /usr/local/bin/backup" > /etc/cron.d/backups-cron
chmod 0644 /etc/cron.d/backups-cron
cron /etc/cron.d/backups-cron
fi
# Configure RCON settings
cat >~/.rcon-cli.yaml <<EOL
host: localhost