-
Notifications
You must be signed in to change notification settings - Fork 1
/
backup.sh
34 lines (34 loc) · 1.11 KB
/
backup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
#turn off autosave to prevent conflicts.
mcrcon -H 127.0.0.1 -P 25575 -p password save-off
#backup loop, should switch to rsync
while true
do
sleep 300
#initiate minecraft server save to ramdisk
mcrcon -H 127.0.0.1 -P 25575 -p password save-all
#copy from ramdisk to backup
echo backing up
sudo rsync -r /var/minecraft/Tracker1.16/minecraft/world /var/minecraft/Tracker1.16/backup1
#update latest.txt
echo "The latest backup is /backup1" > latest.txt
echo backup done
sleep 300
#initiate minecraft server save to ramdisk
mcrcon -H 127.0.0.1 -P 25575 -p password save-all
#copy from ramdisk to backup
echo backing up
sudo rsync -r /var/minecraft/Tracker1.16/minecraft/world /var/minecraft/Tracker1.16/backup2
#update latest.txt
echo "The latest backup is /backup2" > latest.txt
echo backup done
sleep 300
#initiate minecraft server save to ramdisk
mcrcon -H 127.0.0.1 -P 25575 -p password save-all
#copy from ramdisk to backup
echo backing up
sudo rsync -r /var/minecraft/Tracker1.16/minecraft/world /var/minecraft/Tracker1.16/backup3
#update latest.txt
echo "The latest backup is /backup3" > latest.txt
echo backup done
done