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

Last change on this file since 17 was 17, checked in by alloc, 11 years ago

Version 4

File size: 855 bytes
RevLine 
[17]1#!/bin/bash
2# Version 4
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.