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

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

Added backup hook (still V.8)

File size: 902 bytes
RevLine 
[17]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
[26]25 for H in $(getHooksFor backup); do
26 $H $NewBackup
27 done
28
[17]29 #echo "Backup folder disk usage: `$DU -sh $SDTD_BACKUP_ROOT`"
30}
31
32sdtdCommandBackupHelp() {
33 echo "Usage: $(basename $0) backup"
34 echo
35 echo "Backups all data files (instance configurations, save data, logs)."
36}
37
38sdtdCommandBackupDescription() {
39 echo "Backup game data files"
40}
Note: See TracBrowser for help on using the repository browser.