Initial Setup of scripts

This commit is contained in:
Eric Teunis de Boone 2019-01-20 22:09:02 +01:00
commit d348d5f616
6 changed files with 46 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*
!*.sh
!scripts/*

View file

@ -0,0 +1,23 @@
#!/bin/bash
# Mount the backup partition DEV
#+ and execute all *.active scripts in the SCRIPTDIR directory
MOUNTPOINT="/tmp/backup_partition"
DEV="/dev/sda4"
ERR_NOSCRIPT=2
[ -d $MOUNTPOINT ] || mkdir $MOUNTPOINT
mount $DEV $MOUNTPOINT
[ ! -d $SCRIPTDIR ] && exit $ERR_NOSCRIPT
for s in $SCRIPTDIR/*.active
do
[ -x $s ] && ./$s
done
umount $DEV

5
scripts/backup_etc Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
ARCHIVE=/backup/etc/$(hostname -s)_$(date +%F)_etc.tar.gz
tar -cz -C /etc -f $ARCHIVE .

5
scripts/backup_mail Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
ARCHIVE=/backup/mail/$(hostname -s)_$(date +%F)_vmail.tar.gz
tar -cz -C /var/vmail -f $ARCHIVE .

5
scripts/backup_mysql Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
ARCHIVE=/backup/mysql/$(hostname -s)_$(date +%F)_mysql.gz
mysqldump --all-databases | gzip > $ARCHIVE

5
scripts/backup_named Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
ARCHIVE=/backup/named/$(hostname -s)_$(date +%F)_named.tar.gz
tar -cz -C /var/named -f $ARCHIVE .