|
|
@ -12,9 +12,6 @@ hour=$(date +%H) |
|
|
|
day=$(date +%d) |
|
|
|
month=$(date +%m) |
|
|
|
year=$(date +%Y) |
|
|
|
# check if any players are currently logged in |
|
|
|
mcbe-exec list > /dev/null |
|
|
|
players=$(mcbe-exec list | head -n 1 | cut -d ' ' -f 3 | cut -d '/' -f 1) |
|
|
|
|
|
|
|
# cd to backup dir |
|
|
|
cd /vol/data/backup |
|
|
@ -26,9 +23,9 @@ mcbe-backup worlds-hourly-$hour |
|
|
|
if [[ $hour -eq 1 ]]; then |
|
|
|
# if no players are present, restart the server |
|
|
|
# should help deal with any memory leaks |
|
|
|
players=$(mcbe-exec list | head -n 1 | cut -d ' ' -f 3 | cut -d '/' -f 1) |
|
|
|
if [[ $players -eq 0 ]]; then |
|
|
|
mcbe-shutdown |
|
|
|
systemctl start mcbe |
|
|
|
mcbe-restart |
|
|
|
fi |
|
|
|
# save daily and longterm backups |
|
|
|
rsync -a worlds-hourly-$hour/ worlds-daily-$day/ |
|
|
|