#
# tar handler script for backupninja
-getconf backupname `hostname --fqdn`
-getconf backupdir /var/backups/`hostname --fqdn`
getconf compress bzip
getconf includes "/etc /home /usr/local"
getconf excludes "/tmp /proc /dev /sys /net /misc /media /srv /selinux"
fi
function make_backup () {
+ getconf backupdir /var/backups/`hostname --fqdn`
+ backupdir=`interpolate "$backupdir"`
+ getconf backupname `hostname --fqdn`
+ backupname=`interpolate "$backupname"`
+
if [ ! -d "$backupdir" ]
then
mkdir -p "$backupdir" || fatal "Can not make directory $backupdir"
exclude_options=""
for i in $excludes
do
- exclude_options="$exclude_options --exclude $i"
+ exclude_options="$exclude_options --exclude $root$i"
+ done
+
+ include_options=""
+ for i in $includes
+ do
+ include_options="$include_options $root$i"
done
debug "Running backup: " $TAR -c -p -v $compress_option $exclude_options \
-f "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`".$EXTENSION" \
- $includes
+ $include_options
$TAR -c -p -v $compress_option $exclude_options \
-f "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`".$EXTENSION" \
- $includes \
+ $include_options \
> "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`.list \
2> "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`.err
}
-make_backup
+init_source_hosts
+run_for_source_hosts make_backup