Activated scripts, and used env vars
This commit is contained in:
parent
d348d5f616
commit
94c4257c70
9 changed files with 38 additions and 22 deletions
|
@ -4,20 +4,36 @@
|
|||
#+ and execute all *.active scripts in the SCRIPTDIR directory
|
||||
|
||||
MOUNTPOINT="/tmp/backup_partition"
|
||||
DEV="/dev/sda4"
|
||||
DEV="/dev/mapper/data-backup"
|
||||
SCRIPTDIR="$MOUNTPOINT/scripts"
|
||||
|
||||
|
||||
ERR_NOSCRIPT=2
|
||||
ERRS=
|
||||
|
||||
[ -d $MOUNTPOINT ] || mkdir $MOUNTPOINT
|
||||
|
||||
echo "Mounting '${DEV}' at '${MOUNTPOINT}'"
|
||||
mount $DEV $MOUNTPOINT
|
||||
|
||||
[ ! -d $SCRIPTDIR ] && exit $ERR_NOSCRIPT
|
||||
|
||||
for s in $SCRIPTDIR/*.active
|
||||
do
|
||||
[ -x $s ] && ./$s
|
||||
if [ -x $s ]; then
|
||||
printf "Executing ${s}:"
|
||||
source $s
|
||||
retval="$?"
|
||||
if [ $retval == 0 ]; then
|
||||
printf " [ OK ] \n"
|
||||
else
|
||||
printf " [ Error:${retval} ] \n"
|
||||
ERRS="${ERRS} ${s}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Unmounting '${DEV}'"
|
||||
umount $DEV
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
ARCHIVE=/backup/etc/$(hostname -s)_$(date +%F)_etc.tar.gz
|
||||
|
||||
tar -cz -C /etc -f $ARCHIVE .
|
5
scripts/backup_etc.active
Normal file
5
scripts/backup_etc.active
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
ARCHIVE=$MOUNTPOINT/etc/$(hostname -s)_$(date +%F)_etc.tar.gz
|
||||
|
||||
tar -cz -C /etc -f $ARCHIVE .
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
ARCHIVE=/backup/mail/$(hostname -s)_$(date +%F)_vmail.tar.gz
|
||||
|
||||
tar -cz -C /var/vmail -f $ARCHIVE .
|
5
scripts/backup_mail.active
Normal file
5
scripts/backup_mail.active
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
ARCHIVE=$MOUNTPOINT/mail/$(hostname -s)_$(date +%F)_vmail.tar.gz
|
||||
|
||||
tar -cz -C /var/vmail -f $ARCHIVE .
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
ARCHIVE=/backup/mysql/$(hostname -s)_$(date +%F)_mysql.gz
|
||||
|
||||
mysqldump --all-databases | gzip > $ARCHIVE
|
5
scripts/backup_mysql.active
Normal file
5
scripts/backup_mysql.active
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
ARCHIVE=$MOUNTPOINT/mysql/$(hostname -s)_$(date +%F)_mysql.gz
|
||||
|
||||
mysqldump --all-databases | gzip > $ARCHIVE
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
ARCHIVE=/backup/named/$(hostname -s)_$(date +%F)_named.tar.gz
|
||||
|
||||
tar -cz -C /var/named -f $ARCHIVE .
|
5
scripts/backup_named.active
Normal file
5
scripts/backup_named.active
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
ARCHIVE=$MOUNTPOINT/named/$(hostname -s)_$(date +%F)_named.tar.gz
|
||||
|
||||
tar -cz -C /var/named -f $ARCHIVE .
|
Loading…
Reference in a new issue