add rsync-backup script for incrementall backups

This commit is contained in:
Tobias Powalowski 2018-06-22 14:56:13 +02:00
parent 5167cffb05
commit f9469a99f5
2 changed files with 34 additions and 0 deletions

32
usr/bin/rsync-backup.sh Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
#
# copy-mointpoint.sh - copy recursivly a mountpoint using tar
# by Tobias Powalowski <tpowa@archlinux.org>
# usage(exitvalue)
# outputs a usage message and exits with value
APPNAME=$(basename "${0}")
usage()
{
echo "RSYNC BACKUP:"
echo "- Copy backupdir to backupdestination using rsync."
echo ""
echo "- For system backup start with full mounted system and then invoke this script"
echo " with system's root directory as backupdir."
echo " - excluded directories are /dev /tmp /proc /sys /run /mnt /media /lost+found"
echo " - --numeric-ids option is invoked to preserve users"
echo ""
echo "usage: ${APPNAME} <backupdir> <backupdestination>"
exit $1
}
##################################################
if [ $# -ne 2 ]; then
usage 1
fi
BACKUPDESTINATION="${2}"
BACKUPDIR="${1}"
rsync -aAXv --numeric-ids --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} $BACKUPDIR $BACKUPDESTINATION

View file

@ -84,6 +84,8 @@ build ()
### add copy-mountpoint.sh ### add copy-mountpoint.sh
add_file "/usr/bin/copy-mountpoint.sh" add_file "/usr/bin/copy-mountpoint.sh"
### add rsync-backup.sh
add_file "/usr/bin/rsync-backup.sh"
### add pam ### add pam
apps="mkhomedir_helper pam_tally pam_tally2 pam_timestamp_check unix_chkpwd unix_update" apps="mkhomedir_helper pam_tally pam_tally2 pam_timestamp_check unix_chkpwd unix_update"