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

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

Version 6: Instance editing more userfriendly

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