#!/bin/bash
#
# backup-script system for cloning systems using rsync
-# Copyright (c)2008-2014 Alexander Barton, alex@barton.de
+# Copyright (c)2008-2015 Alexander Barton <alex@barton.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
NAME=`basename $0`
-CONF_D="/etc/backup-script.d"
PIDFILE="/var/run/$NAME.pid"
DRYRUN=0
destinations=""
# Default settings, can be overwritten in backup-script.conf:
+conf_d="/etc/backup-script.d"
pre_exec=""
post_exec=""
default_target=""
esac
done
-if [ $# -ge 1 ]; then
- for s in $@; do
- if [ ! -r "${CONF_D}/$s" ]; then
- echo "$NAME: Can' read \"${CONF_D}/$s\"!"
- exit 1
- fi
- sys="$sys ${CONF_D}/$s"
- done
-else
- sys=${CONF_D}/*
-fi
-
trap GotSignal SIGINT
echo -n "Started: "; date
-for conf in "/etc/backup-script.conf" "${CONF_D}/backup-script.conf"; do
+for conf in "/etc/backup-script.conf" "${conf_d}/backup-script.conf"; do
if [ -r "$conf" ]; then
echo "Reading configuration: \"$conf\" ..."
source "$conf"
done
echo
+if [ $# -ge 1 ]; then
+ for s in $@; do
+ if [ ! -r "${conf_d}/$s" ]; then
+ echo "$NAME: Can' read \"${conf_d}/$s\"!"
+ exit 1
+ fi
+ sys="$sys ${conf_d}/$s"
+ done
+else
+ sys=${conf_d}/*
+fi
+
# check and create PID file
if [ -e "$PIDFILE" ]; then
echo "Lockfile \"$PIDFILE\" already exists."
|| systxt="\"$fname\" [\"$system\"]"
[ "$local" -eq 0 ] \
&& echo "Working on $systxt ..." \
- || echo "Working on $sytxts (local system) ..."
+ || echo "Working on $systxt (local system) ..."
count_all=$count_all+1
mkdir -p "$sys_target" >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Can't create \"$sys_target\"!? \"$system\" skipped!"
- echo continue
+ echo; continue
fi
fi