source: scripts/usr/local/lib/7dtd/commands/backup.sh@ 20

Last change on this file since 20 was 20, checked in by alloc, 10 years ago

Version 5. Fixes #9, #11

File size: 855 bytes
RevLine 
[17]1#!/bin/bash
[20]2# Version 5
[17]3
4# Backups game data files.
5
6sdtdCommandBackup() {
7 DT=`date "+%Y-%m-%d_%H-%M"`
8 NewBackup=$SDTD_BACKUP_ROOT/$DT
9
10 # Check for backup folder existence
11 if [ -e $SDTD_BACKUP_ROOT ]; then
12 # Exists, copy(link) latest backup
13 unset -v LatestBackup
14 for file in "$SDTD_BACKUP_ROOT"/*; do
15 [[ $file -nt $LatestBackup ]] && LatestBackup=$file
16 done
17 cp -al $LatestBackup $NewBackup
18 else
19 # Create new backup dir
20 mkdir $SDTD_BACKUP_ROOT
21 fi
22
23 $RSYNC -a --delete --numeric-ids --delete-excluded $SDTD_BASE/instances/./ $NewBackup
24 touch $NewBackup
25
26 #echo "Backup folder disk usage: `$DU -sh $SDTD_BACKUP_ROOT`"
27}
28
29sdtdCommandBackupHelp() {
30 echo "Usage: $(basename $0) backup"
31 echo
32 echo "Backups all data files (instance configurations, save data, logs)."
33}
34
35sdtdCommandBackupDescription() {
36 echo "Backup game data files"
37}
Note: See TracBrowser for help on using the repository browser.