summaryrefslogtreecommitdiffstats
path: root/linhes
diff options
context:
space:
mode:
Diffstat (limited to 'linhes')
-rwxr-xr-xlinhes/linhes-system/PKGBUILD4
-rwxr-xr-xlinhes/linhes-system/lh_system_backup_job66
2 files changed, 40 insertions, 30 deletions
diff --git a/linhes/linhes-system/PKGBUILD b/linhes/linhes-system/PKGBUILD
index fc20a53..34d9f91 100755
--- a/linhes/linhes-system/PKGBUILD
+++ b/linhes/linhes-system/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=linhes-system
pkgver=9.0.0
-pkgrel=53
+pkgrel=54
arch=('x86_64')
#install=$pkgname.install
pkgdesc="Everything that makes LinHES a system"
@@ -38,7 +38,7 @@ sha256sums=('525bfe29b63d3ec5a17a32fa29745e24070020490c3f5b6dd6b03250348fb324'
'87875d9e5f5ce18208f419698ce69b6bcbcd08955a57a4a13940e715af58b787'
'93d664f4a46fda05d0f754d19df40cbda120e325b80c07092345b14763993833'
'8d6d09cedc85e49712144699ccb905be6ef663e9ab0bc01abd434370ab12fede'
- 'b8871ab7e2aefac6c8ff3149a70d3624a48615fcbec7672ec20d321180d5c846'
+ 'b10f85c7d1d8a728af595da3f7c2f93921a6944346444cf319ca991ee324ae6f'
'91bdec992bb2c933e15625c181f2195c402060b879168ebf35944cb064c904b9'
'5cacfdd02833e5a3130d765573e772e6bd5030336ba86239c5e4db5ffa36fc69'
'ebdb3ee0212e0cc72526bb5e50a032573e1894acb7bf75617243b0b49aa1f8f2'
diff --git a/linhes/linhes-system/lh_system_backup_job b/linhes/linhes-system/lh_system_backup_job
index 8b226ac..7d699f0 100755
--- a/linhes/linhes-system/lh_system_backup_job
+++ b/linhes/linhes-system/lh_system_backup_job
@@ -5,16 +5,43 @@
MYTH_RUN_STATUS="1"
. /etc/profile
. /etc/systemconfig
-BACKUPDIR=/data/storage/disk0/backup/system_backups
-SECBACKUPLINK=/data/storage/disk1
PLEXDIR=/var/lib/plex
KeepBackups=14
DATE=`date +%F_%H-%M`
backup_status=0
MYTHHOME=`lh_home_check.sh`
-
MYTHSHUTDOWN="/usr/bin/mythshutdown"
+#find primary backup location
+for dir in /data/storage/disk*
+do
+ if [ $dir == /data/storage/disk0 ]; then
+ continue
+ fi
+ TESTDIR=`readlink $dir`
+ if [ -n $TESTDIR ]; then
+ BACKUPLINK=$dir
+ BACKUPDISK=$TESTDIR
+ BACKUPDIR=$TESTDIR/backup/system_backups
+ break
+ fi
+done
+
+#find secondary backup location
+for dir in /data/storage/disk*
+do
+ if [[ $dir == /data/storage/disk0 || $dir == $BACKUPLINK ]]; then
+ continue
+ fi
+ TESTDIR=`readlink $dir`
+ if [ -n $TESTDIR ]; then
+ SECBACKUPLINK=$dir
+ SECBACKUPDISK=$TESTDIR
+ SECBACKUPDIR=$TESTDIR/backup/system_backups
+ break
+ fi
+done
+
function lock_myth(){
$MYTHSHUTDOWN --lock
}
@@ -35,6 +62,8 @@ function backup(){
echo
echo "Starting Backup"
+ echo "Backup Directory: $BACKUPLINK --> $BACKUPDIR"
+ echo "Secondary Backup Directory: $SECBACKUPLINK --> $SECBACKUPDIR"
mkdir -p $BACKUPDIR/$DATE
#backup database
@@ -169,7 +198,6 @@ function update_backup_status(){
}
function remove_old_backups(){
-
#remove old backups
NumBackups=`ls $BACKUPDIR/backup*.tgz|wc -l`
if [[ $NumBackups -gt $KeepBackups ]]; then
@@ -207,35 +235,17 @@ function remote_backup(){
fi
else #do local copy to SECBACKUPLINK
echo " Remote backup is not enabled, copying backup to another drive on this system."
- SECBACKUPDISK=`readlink $SECBACKUPLINK`
-
- if [ -z $SECBACKUPDISK ]
- then
- for dir in /data/storage/disk*
- do
- if [ $dir == /data/storage/disk0 ]
- then
- continue
- fi
- TESTDIR=`readlink $dir`
- if [ -n $TESTDIR ]
- then
- SECBACKUPDISK=$TESTDIR
- break
- fi
- done
- fi
if [ -n "$SECBACKUPDISK" ]; then
SECBACKUP=$SECBACKUPDISK/backup
if [ `mountpoint -q -d $SECBACKUPDISK` ]; then
- if [ ! -d "$SECBACKUP" ]; then
- mkdir -p -m 775 $SECBACKUP
- echo " Created $SECBACKUP"
- chown mythtv:users $SECBACKUP
+ if [ ! -d "$SECBACKUPDIR" ]; then
+ mkdir -p -m 775 $SECBACKUPDIR
+ echo " Created $SECBACKUPDIR"
+ chown mythtv:users $SECBACKUPDIR
fi
- echo " Copying system backups to $SECBACKUP"
- rsync -au --delete $BACKUPDIR $SECBACKUP
+ echo " Copying system backups to $SECBACKUPDIR"
+ rsync -au --delete $BACKUPDIR $SECBACKUPDIR
else
echo " $SECBACKUPDISK isn't mounted."
fi