Palworld – How to Backup Your Last 5 World Saves Automatically (Linux Server)

Linux Server How-To Guide

Not sure if this is the best way to do this, but it’s how I’m doing it. The following will back up your World folder and configuration file on a daily basis, and save the most recent 5 copies to a folder in the directory of your choosing.

You can modify the script if you want to keep more or less than 5 copies. This guide assumes you already have a working dedicated server!

First, let’s make the script

sudo nano /usr/local/bin/
  • Once in nano, copy/paste the below code block and edit with the values that reflect your server. Some of these should be default if you’ve followed other Linux configuration guides that utilize the user “steam”.
  • The main things you’ll need to change in the script is your output directory path and the location of your Palworld server.

Important Notes

  • I’m not using the default server location. You will need to change “/home/steam/palworld/” to /home/steam/YOUR SERVER INSTALL LOCATION/
    • I believe the default is /home/steam/Steam/steamapps/common/PalServer
    • Everything within the Palworld directory (/Pal/Saved/*) will all be the same
  • SRC1 will be your configuration file
  • SRC2 will be your world save directory
  • DEST1 will be your configuration output (backup folder)
  • DEST2 will be your world save output (backup folder)
  • BASE_DEST you need to manually mkdir this folder, the script will fail if you don’t

# Define source directories and base destination directory

# Create a timestamp
TIMESTAMP=$(date +"%Y%m%d%H%M%S")

# Create new backup directories for this run

mkdir -p "$DEST1"
mkdir -p "$DEST2"

# Copy files with rsync
rsync -av "$SRC1" "$DEST1/"
rsync -av "$SRC2" "$DEST2/"

# Function to delete oldest backups if more than 5 exist
function delete_oldest_backup {
    local backup_base_path=$1
    local max_backups=5

    # Create an array of backup directories sorted by date (newest to oldest)
    local backups=($(ls -1d $backup_base_path* | sort -r))

    # Keep only the newest $max_backups directories
    local count=${#backups[@]}
    if [ $count -gt $max_backups ]; then
        local backups_to_delete=(${backups[@]:$max_backups})
        for backup in "${backups_to_delete[@]}"; do
            rm -rf "$backup"

# Apply the backup deletion to each type of backup
delete_oldest_backup "$BASE_DEST/palworld_config"
delete_oldest_backup "$BASE_DEST/palworld_savegames"

echo "Backup completed on $(date)"

Save the script by pressing Ctrl + O

Now lets make the script executable by running this command

sudo chmod +x /usr/local/bin/

Next lets test the script to make sure it runs without any errors. Use this command to trigger it manually.

sudo /usr/local/bin/

If you get “Backup completed on DATE” you’re good!

Finally, we need to make the job to run this script every day at the time of your choosing. You can do this with cron. Open the cron configuration file with this command

sudo crontab -e

Scroll to the end of the file, and add this

0 2 * * * /usr/local/bin/

This example will run the backup script daily at 2 AM. It looks confusing, I know, but it’s pretty straight forward. It’s minute, hour, day, month, day of week, command.

– day = # on a calendar (the 1st, the 2nd, etc).- day of week = Monday, Tuesday, Wednesday using 0-6 to represent the day.- I highly recommend leaving month *, but if you really want it to be that infrequent, you can find some information about setting this on the web.

Now lets save it. Once again, press “ctrl + O” and YES to write the cron file. Lets print the contents of cron to ensure our task is present

sudo crontab -l

That should be it, now your save should automatically be backed up to the folder and time of your choosing.

If you ever need to restore it, simply navigate to the directory you saved the world files to, and copy the contents to back to /home/steam/palworld/Pal/Saved/SaveGames/0/

Be the first to comment

Leave a Reply

Your email address will not be published.