diff options
Diffstat (limited to 'abs/core/LinHES-system')
-rwxr-xr-x | abs/core/LinHES-system/PKGBUILD | 4 | ||||
-rw-r--r-- | abs/core/LinHES-system/lh_system_backup_job | 29 |
2 files changed, 29 insertions, 4 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD index e2f4b47..ab3f438 100755 --- a/abs/core/LinHES-system/PKGBUILD +++ b/abs/core/LinHES-system/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-system pkgver=8.0 -pkgrel=36 +pkgrel=37 arch=('i686' 'x86_64') install=system.install pkgdesc="Everything that makes LinHES an automated system" @@ -90,7 +90,7 @@ md5sums=('5ee78704cab0e88ec58d1aab821fc1aa' '33fbebbd546672cedd3c5e7350ab414e' 'c773d8caacba8fbd4968e8afe5137bc6' '3edef50a49a47694bf8add39cc160add' - '5e17e0786afd891550a660f646076308' + 'e8f178a913862e09dfd422a182f41f9e' 'bc69a520add58ede9b060c73e67ace13' '26fdd26e945f0c187f9fdcf98a7a5bef' '47e093e8cfe4b5b96602358e1f540832' diff --git a/abs/core/LinHES-system/lh_system_backup_job b/abs/core/LinHES-system/lh_system_backup_job index e095a97..c3f4e72 100644 --- a/abs/core/LinHES-system/lh_system_backup_job +++ b/abs/core/LinHES-system/lh_system_backup_job @@ -7,7 +7,8 @@ MYTH_RUN_STATUS="1" . /etc/profile . /etc/systemconfig BACKUPDIR=/data/storage/disk0/backup/system_backups -DELETE_DAYS=21 +SECBACKUPLINK=/data/storage/disk1 +KeepBackups=13 DATE=`date +%F_%H-%M` backup_status=0 # @@ -140,7 +141,11 @@ function update_backup_status(){ function remove_old_backups(){ #remove old backups - find $BACKUPDIR/backup*.tgz -type f -mtime +$DELETE_DAYS -delete + NumBackups=`ls $BACKUPDIR/backup*.tgz|wc -l` + if [[ $NumBackups > $KeepBackups ]]; then + numdel=$(($NumBackups-$KeepBackups)) + rm -f `ls $BACKUPDIR/backup*.tgz -tr1|head -$numdel` + fi } @@ -168,6 +173,26 @@ function remote_backup(){ /usr/bin/func ${RemoteBackupDir} copyfile -f $BACKUPDIR/backup.$DATE.tgz --remotepath $BACKUPDIR/MBE_$DATE.tgz fi fi + else #do local copy to SECBACKUPLINK + echo "Remote backup is not enabled, copying backup to $SECBACKUPLINK if it exists" + SECBACKUPDISK=`readlink $SECBACKUPLINK` + SECBACKUP=$SECBACKUPDISK/backup + + if [ -n "$SECBACKUPDISK" ]; then + if [ `mountpoint -q -d $SECBACKUPDISK` ]; then + if [ ! -d "$SECBACKUP" ]; then + mkdir -p -m 775 $SECBACKUP + echo "Created $SECBACKUP" + chown mythtv:users $SECBACKUP + fi + echo "Copying systems_backups" + rsync -au --delete $BACKUPDIR $SECBACKUP + else + echo "$SECBACKUPDISK isn't mounted." + fi + else + echo "Link $SECBACKUPLINK doesn't exist." + fi fi } |