So i have 1.21.3 spigot server and i am trying to configure backups for my server. I could not find any documentation about /backup command in EssentialsX, so i followed Essentials wiki.
Important note is that my server is running on Debian
I added the following into my config.yml file
I also tried just 'backup.sh' but it did not work either. It just gives me "Error: An external backup script has not been configured" although i made "backup.sh" file in my main server directory. The script works when i just run it with bash so i have no idea why Essentials wont work with it. Does backup function even works in EssentialsX nowdays???
UPD: i was able to make backup work, but now it gives me the following
I tried both absolute and relative paths. Didnt work
An error occurred while building the backup child process
java.io.IOException: Cannot run program "backup.sh": error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1170) ~[?:?]
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089) ~[?:?]
at com.earth2me.essentials.Backup.lambda$run$1(Backup.java:93) ~[?:?]
at org.bukkit.craftbukkit.v1_21_R3.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.21.4-R0.1-SNAPSHOT.jar:4424-Spigot-aa7842e-442838f]
at org.bukkit.craftbukkit.v1_21_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) ~[spigot-1.21.4-R0.1-SNAPSHOT.jar:4424-Spigot-aa7842e-442838f]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method) ~[?:?]
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:295) ~[?:?]
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:225) ~[?:?]
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1126) ~[?:?]
... 7 more
Well, Gemnin wrote it for me but i tried to run it and it works. Anyway, so generally what it does is that it copies all worlds into a new folder in backups/ and names it "backup <timestamp>"
#!/bin/bash
# Set the source directories
source_dirs=("world" "world_nether" "world_the_end")
# Set the backup directory
backup_dir="backups"
# Check if source directories exist
for source_dir in "${source_dirs[@]}"; do
if [ ! -d "$source_dir" ]; then
echo "Error: Source directory '$source_dir' not found."
exit 1
fi
done
# Check if backup directory exists, create if not
if [ ! -d "$backup_dir" ]; then
echo "Backup directory '$backup_dir' not found, creating it..."
mkdir -p "$backup_dir"
fi
# Get current date and time in desired format YYYY-MM-DD-HH-MM-SS
timestamp=$(date +%Y-%m-%d-%H-%M-%S)
# Create the new backup directory name
new_backup_dir="$backup_dir/backup $timestamp"
# Create backup directory
mkdir -p "$new_backup_dir"
# Copy the directories
for source_dir in "${source_dirs[@]}"; do
cp -a "$source_dir" "$new_backup_dir/"
# Check if copy was successful
if [ $? -ne 0 ]; then
echo "Error: Failed to copy directory '$source_dir' to '$new_backup_dir'."
exit 1
fi
done
# Check if all copies were successful
if [ $? -eq 0 ]; then
echo "Directories '${source_dirs[@]}' successfully backed up to '$new_backup_dir'."
else
echo "Error: Failed to backup some directories."
exit 1
fi
exit 0
So i have 1.21.3 spigot server and i am trying to configure backups for my server. I could not find any documentation about /backup command in EssentialsX, so i followed Essentials wiki.
Important note is that my server is running on Debian
I added the following into my config.yml file
I also tried just 'backup.sh' but it did not work either. It just gives me "Error: An external backup script has not been configured" although i made "backup.sh" file in my main server directory. The script works when i just run it with bash so i have no idea why Essentials wont work with it. Does backup function even works in EssentialsX nowdays???
UPD: i was able to make backup work, but now it gives me the following
I tried both absolute and relative paths. Didnt work
Change this to:
Make sure the backup.sh is in the same folder as the spigot server jar file
>> Link to Curseforge <<
Tried that already. Here is directory as a proof that i have .sh file there. I still cant get it to work - same error
Add the lines of the backup.sh
>> Link to Curseforge <<
Well, Gemnin wrote it for me but i tried to run it and it works. Anyway, so generally what it does is that it copies all worlds into a new folder in backups/ and names it "backup <timestamp>"