auto-backup-Mimik steht
This commit is contained in:
1 parent
1fcdb5669a
commit
22d9442b42
17 files changed
+223
-738
No files matched your search
@@ -3,27 +3,45 @@
|
||||
# entrypoint for all actions
|
||||
#
|
||||
|
||||
|
||||
HERE=$(dirname "$0")
|
||||
. $HERE/main.inc.sh
|
||||
|
||||
|
||||
|
||||
show_help() {
|
||||
echo "usage: $0 options"
|
||||
echo " -a, --auto start nightly backup on local machine"
|
||||
echo " -d, --daily start daily backup on local machine"
|
||||
echo " -w, --weekly start weekly backup on local machine"
|
||||
echo " --list list archives"
|
||||
echo ' --content <archive> '
|
||||
echo " show contents of archive"
|
||||
echo ' -r, --restore <archive> <file(s)> '
|
||||
echo " restore files from archive to pwd"
|
||||
echo " -h, -?. --help show this help"
|
||||
echo " "
|
||||
echo " Script muss auf dem jeweiligen Server ausgeführt werden (ggf. via ssh)."
|
||||
echo " "
|
||||
}
|
||||
|
||||
echo " ### main.sh"
|
||||
HERE=$(dirname "$0")
|
||||
|
||||
if [ -f $HERE/main.inc.sh ]; then
|
||||
. $HERE/main.inc.sh
|
||||
else
|
||||
echo "**"
|
||||
echo "** ERROR: Datei \"$HERE/main.inc.sh\" nicht gefunden. "
|
||||
echo "** Script wird abgebrochen"
|
||||
echo "**"
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f $HERE/$HOST_NAME.sh ]; then
|
||||
. $HERE/$HOST_NAME.sh
|
||||
else
|
||||
echo "**"
|
||||
echo "** ERROR: Datei \"$HOST_NAME.sh\" nicht gefunden (falscher Rechner?). "
|
||||
echo "** Script wird abgebrochen."
|
||||
echo "**"
|
||||
show_help
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Initialize all the option variables.
|
||||
# This ensures we are not contaminated by variables from the environment.
|
||||
file=
|
||||
archive=
|
||||
|
||||
@@ -33,18 +51,24 @@ while :; do
|
||||
show_help # Display a usage synopsis.
|
||||
exit 0
|
||||
;;
|
||||
-a|--auto)
|
||||
shift
|
||||
. $HERE/$HOST_NAME.sh "$@" # >$LOGF 2>&1
|
||||
break # exit kehrt nicht zu run.sh zurück
|
||||
-d|--daily)
|
||||
backup_daily
|
||||
break
|
||||
;;
|
||||
-w|--weekly)
|
||||
backup_weekly
|
||||
break
|
||||
;;
|
||||
--list)
|
||||
. $HERE/$HOST_NAME.sh -l
|
||||
list_archives "$NAS_ROOT/daily/$HOST_NAME"
|
||||
if [ -d "$NAS_ROOT/weekly/$HOST_NAME" ]; then
|
||||
list_archives "$NAS_ROOT/weekly/$HOST_NAME"
|
||||
fi
|
||||
break;
|
||||
;;
|
||||
--content)
|
||||
if [ "$2" ]; then
|
||||
. $HERE/$HOST_NAME.sh -c $2
|
||||
list_archive_content "$NAS_ROOT" "$2"
|
||||
else
|
||||
echo 'ERROR: "--content" requires a non-empty option argument.'
|
||||
fi
|
||||
@@ -52,10 +76,9 @@ while :; do
|
||||
;;
|
||||
-r|--restore)
|
||||
if [ "$2" ]; then
|
||||
echo "not yet implemented"
|
||||
archive=$2
|
||||
shift
|
||||
#. $HERE/$HOST_NAME.sh -r $archive $@
|
||||
restore "$archive" "$@"
|
||||
else
|
||||
echo 'ERROR: "--restore" requires a non-empty option argument.'
|
||||
fi
|
||||
@@ -94,3 +117,4 @@ while :; do
|
||||
shift
|
||||
done
|
||||
|
||||
exit 0
|
||||
Reference in new issue
Block a user