forked from thijsvanloef/palworld-server-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request thijsvanloef#260 from Dashboy1998/reboot-cron-job
Reboot cron job
- Loading branch information
Showing
5 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
if [ "${RCON_ENABLED,,}" = true ]; then | ||
if [ -z "${AUTO_REBOOT_WARN_MINUTES}" ]; then | ||
echo "Unable to auto reboot, AUTO_REBOOT_WARN_MINUTES is empty." | ||
elif [[ "${AUTO_REBOOT_WARN_MINUTES}" =~ ^[0-9]+$ ]]; then | ||
for ((i = "${AUTO_REBOOT_WARN_MINUTES}" ; i > 0 ; i--)); do | ||
rcon-cli -c /home/steam/server/rcon.yaml "broadcast The_Server_will_reboot_in_${i}_Minutes" | ||
sleep "1m" | ||
done | ||
|
||
rcon-cli -c /home/steam/server/rcon.yaml save | ||
rcon-cli -c /home/steam/server/rcon.yaml "shutdown 1" | ||
else | ||
echo "Unable to auto reboot, AUTO_REBOOT_WARN_MINUTES is not an integer: ${AUTO_REBOOT_WARN_MINUTES}" | ||
fi | ||
else | ||
echo "Unable to reboot. RCON is required." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters