Remember to replace the folder directory, <AdminPassword>
, <RCONPort>
to your own.
Also, you need to use crontab
to schedule the following scripts if necessary.
I'm using supervisor to restart the service, the example config is as:
[program:pal]
command="/home/steam/.local/share/Steam/steamapps/common/PalServer/Pal/Binaries/Linux/PalServer-Linux-Test" Pal -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS
numprocs=1
process_name=pal-%(process_num)d
directory=/home/steam/.local/share/Steam/steamapps/common/PalServer
user=steam
environment=HOME="/home/steam",USER="steam"
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/pal.out
stderr_logfile=/var/log/supervisor/pal.err
#!/bin/sh
DDATE=`date "+%F-%T"`
mkdir $DDATE
cp -r /home/steam/steamapps/common/PalServer/Pal/Saved/SaveGames $DDATE/
Need to:
#!/bin/sh
RCON_PORT=<RCONPort>
ADMIN_PASSWORD=<AdminPassword>
echo 'broadcast Auto_Reboot_Initialized' | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
echo 'save' | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
echo "shutdown 300 Server_is_going_to_reboot_in_5_minutes" | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
sleep 120
echo 'broadcast Server_is_going_to_reboot_in_3_minutes' | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
sleep 60
echo 'broadcast Server_is_going_to_reboot_in_2_minutes' | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
sleep 60
echo 'broadcast Server_is_going_to_reboot_in_60_seconds' | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
sleep 50
echo 'broadcast Server_is_going_to_reboot_in_10_seconds' | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
sleep 5
echo 'broadcast Server_is_going_to_reboot_in_5_seconds' | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
sleep 1
echo 'broadcast Server_is_going_to_reboot_in_4_seconds' | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
sleep 1
echo 'broadcast Server_is_going_to_reboot_in_3_seconds' | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
sleep 1
echo 'broadcast Server_is_going_to_reboot_in_2_seconds' | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
sleep 1
echo 'broadcast Server_is_going_to_reboot_in_1_second' | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
Need to install bc
by apt install bc
.
#!/bin/bash
RCON_PORT=<RCONPort>
ADMIN_PASSWORD=<AdminPassword>
THRESHOLD=80
MEMORY_USAGE=$(free | grep Mem | awk '{print $3/$2 * 100.0}')
if (( $(echo "$MEMORY_USAGE > $THRESHOLD" | bc -l) )); then
echo "Memory usage is above $THRESHOLD%. Running clean command."
echo "broadcast Memory_Is_Above_$THRESHOLD%" | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
echo "save" | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
echo "shutdown 60 Reboot_In_60_Seconds" | ./ARRCON -P $RCON_PORT -p $ADMIN_PASSWORD
cd ~/backups ; ./backup.sh
else
echo "Memory usage is below $THRESHOLD%. No action required."
fi
- Exiting the guild will cause all players who was not logged-in at the moment to corrupt their save files! (Joining another guild will exit the old one as well.) Next time they log in they'll stuck at the loading spinning black screen. You can either clean the save files of those who got corrupted or restore a backup. Now fixable by https://gist.github.com/Bluefissure/f277a3409cdaf09cddbad5983fd01f68
I ended up using linuxGSM and a combo of these scripts, and that is working very nicely.
https://linuxgsm.com/servers/pwserver/
I followed that, and in the home folder of /home/pwserver I put a few of my custom scripts, based on these.
and assigned crontab to them as well, in linuxgsm they mention whats recommended, and when your in user pwserver just type crontab -e to add more commands.
I added restart every 6 hours and a save command every 15 minutes (since we had some issues with roll backs before moving to linuxgsm)
restart script,
Backup Script
Save script
RCON is just the ARRCON executable in my case sitting in /home/pwserver
my crontab -e looks like
monitor is responsible for checking if server is running and restarting it if nessicary, update checks for steam updates and will stop and update server if its avaliable, I just wanted regular restarts that are graceful since linuxgsm wasn't offering that.