1
2
3
4
5
6
7
8
9
10
11
12
13 MC_PATH="$HOME/test"
14 WORLDS_DIR="$MC_PATH/worlds"
15 PLUGINS_DIR="$MC_PATH/plugins"
16 LOG_FILE="$MC_PATH/backup.log"
17
18
19 BACKUP_PATH="/tmp/test"
20
21
22 NEW_FOLDER=$(date +"%Y/%B/%d/%H:%M")
23 TIMESTAMP=$(date +"%D %T")
24
25
26
27 SFTP_ARGS=(-P 32 -i /path/to/key user@127.0.0.1)
28 SSH_ARGS=(-p 32 -i /path/to/key user@127.0.0.1)
29
30
31
32
33
34
35
36 echo "target backup directory: $NEW_FOLDER"
37 echo "log timestamp: $TIMESTAMP"
38
39
40 echo "Making a fake local world..."
41 mkdir -p "$WORLDS_DIR"/world
42 mkdir -p "$PLUGINS_DIR"/dummy_plugin
43 echo "this is a test" > "$WORLDS_DIR"/world/test.txt
44
45
46 echo "Making some fake hourly backups on the remote server..."
47 bakday=$(date --date="1 day ago" +%d)
48 ssh "${SSH_ARGS[@]}" "mkdir -p $BACKUP_PATH/2020/January/$bakday/{00..23}:00"