3 # backup-script system for cloning systems using rsync
4 # Copyright (c)2008-2013 Alexander Barton, alex@barton.de
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 # Please read the file COPYING, README and AUTHORS for more information.
14 CONF_D="/etc/backup-script.d"
21 # Default settings, can be overwritten in backup-script.conf:
24 if [ "$1" == "-q" ]; then
31 echo "Usage: $NAME [-p] [<system> [<system> [...]]]"
38 if [ ! -r "${CONF_D}/$s" ]; then
39 echo "$NAME: Can' read \"${CONF_D}/$s\"!"
42 sys="$sys ${CONF_D}/$s"
48 [ -r "${CONF_D}/backup-script.conf" ] && source "${CONF_D}/backup-script.conf"
51 [ -r "$f" -a -f "$f" ] || continue
55 "backup-script.conf"|*.sh)
62 target="$default_target"
64 # Read in system configuration file
67 # Validate configuration
68 [ "$system" = "localhost" -o "$system" = "127.0.0.1" ] && local=1
71 target="$target/$system"
73 [ -d "$target" ] || continue
76 [ "$system" = "$fname" ] && echo "$system" || echo "$system [$fname]"
78 # System target directory
79 echo "- Target: $target"
80 if [ "$QUICK" = "0" ]; then
81 size=`du -sh "$target" | cut -f1`
85 # Timestamp and result code
86 if [ -f "$target/.stamp" ]; then
87 last=`stat "$target/.stamp" | grep "^Modify: " | cut -d':' -f2- | cut -d. -f1`
88 [ -n "$last" ] && echo "- Date:" $last
90 source "$target/.stamp"
91 [ -n "$code" ] && echo "- Result code:" $code
93 echo "- No timestamp recorded!?"
100 if [ $count -lt 1 ]; then
101 echo "No backups found!"
104 echo "$count system backup(s) found."