summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/LinHES-system')
-rwxr-xr-xabs/core/LinHES-system/PKGBUILD4
-rw-r--r--abs/core/LinHES-system/lh_system_backup_job30
2 files changed, 24 insertions, 10 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 2479cab..84a11e7 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-system
pkgver=8.4
-pkgrel=12
+pkgrel=13
arch=('i686' 'x86_64')
install=system.install
pkgdesc="Everything that makes LinHES an automated system"
@@ -96,7 +96,7 @@ md5sums=('c6e6b83a1f4c35ef4501e277657ab2ac'
'33fbebbd546672cedd3c5e7350ab414e'
'c773d8caacba8fbd4968e8afe5137bc6'
'3edef50a49a47694bf8add39cc160add'
- 'a730185e0d5d8bd0b6d06938d841c8c0'
+ '01cbbf411d2a585feb71f2881755e5d8'
'bc69a520add58ede9b060c73e67ace13'
'74e17d6f7453c52d56fecaed5c3f6ad5'
'47e093e8cfe4b5b96602358e1f540832'
diff --git a/abs/core/LinHES-system/lh_system_backup_job b/abs/core/LinHES-system/lh_system_backup_job
index 00ab5f6..8539ff2 100644
--- a/abs/core/LinHES-system/lh_system_backup_job
+++ b/abs/core/LinHES-system/lh_system_backup_job
@@ -8,7 +8,7 @@ MYTH_RUN_STATUS="1"
. /etc/systemconfig
BACKUPDIR=/data/storage/disk0/backup/system_backups
SECBACKUPLINK=/data/storage/disk1
-KeepBackups=13
+KeepBackups=14
DATE=`date +%F_%H-%M`
backup_status=0
#
@@ -20,7 +20,7 @@ function lock_myth(){
}
function unlock_myth(){
- $MYTHSHUTDOWN --unlock
+ $MYTHSHUTDOWN --unlock
}
function backup_status_check(){
@@ -131,10 +131,20 @@ function backup(){
cd $BACKUPDIR
tar -zcf $BACKUPDIR/backup.$DATE.tgz $DATE
backup_status_check $?
- if [ -d $BACKUPDIR/$DATE ]
- then
- rm -rf $BACKUPDIR/$DATE
- fi
+ if [ -d $BACKUPDIR/$DATE ]
+ then
+ rm -rf $BACKUPDIR/$DATE
+ fi
+
+ if [ $backup_status -eq 0 ]
+ then
+ BACKUPPATH=$BACKUPDIR/backup.$DATE.tgz
+ else
+ echo "Backup had an error"
+ mkdir $BACKUPDIR/errored_backups
+ mv $BACKUPDIR/backup.$DATE.tgz $BACKUPDIR/errored_backups/backup.$DATE.tgz
+ BACKUPPATH=$BACKUPDIR/errored_backups/backup.$DATE.tgz
+ fi
if [ -f /home/xymon/server/ext/hbnotes.py ]
then
@@ -143,7 +153,7 @@ function backup(){
fi
echo
echo "Created backup file:"
- echo " $BACKUPDIR/backup.$DATE.tgz"
+ echo " $BACKUPPATH"
}
function update_backup_status(){
@@ -292,9 +302,13 @@ function remove_link(){
lock_myth
if [ "x$1" = "x" ]
then
- remove_old_backups
backup
update_backup_status
+ #only remove old backups if there was no problems
+ if [ $backup_status -eq 0 ]
+ then
+ remove_old_backups
+ fi
remote_backup
add_link
else