summaryrefslogtreecommitdiffstats
path: root/abs/core
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2016-06-02 13:38:41 (GMT)
committerBritney Fransen <brfransen@gmail.com>2016-06-02 13:38:41 (GMT)
commit6c64e71dfd56cc016c590a4fd9f2d3d19930c852 (patch)
tree9c13eace5fe932a085d357cb29d31938ef2cb8b1 /abs/core
parent687c448639854fd5da173ffdf1c0c463491fc7f3 (diff)
downloadlinhes_pkgbuild-6c64e71dfd56cc016c590a4fd9f2d3d19930c852.zip
linhes_pkgbuild-6c64e71dfd56cc016c590a4fd9f2d3d19930c852.tar.gz
linhes_pkgbuild-6c64e71dfd56cc016c590a4fd9f2d3d19930c852.tar.bz2
LinHES-system: lh_system_backup_job: check for backup error and don't remove old backups
if backup errors put backup in errored_backup dir
Diffstat (limited to 'abs/core')
-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