From 33471a3c24b10318006e350ee3f5b93cb76aafc8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 9 Mar 2008 23:06:18 +0100 Subject: [PATCH] update ccollect_delete_source.sh to 0.7 style - and update manpages to the new names - on the way home from duebendorf - rapperswil - bellinzona - giubiasco - zuerich - gossau! --- doc/man/ccollect_add_source.text | 16 +++++++------ doc/man/ccollect_delete_source.text | 14 +++++------ tools/ccollect_delete_source.sh | 36 ++++++++++++++++++++--------- 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/doc/man/ccollect_add_source.text b/doc/man/ccollect_add_source.text index 98f4198..ba070d9 100644 --- a/doc/man/ccollect_add_source.text +++ b/doc/man/ccollect_add_source.text @@ -5,20 +5,21 @@ Nico Schottelius NAME ---- -add_ccollect_source - create new source for ccollect(1) +ccollect_add_source - create new source for ccollect(1) SYNOPSIS -------- -'add_ccollect_source.sh' +'ccollect_add_source.sh' DESCRIPTION ----------- -add_ccollect_source.sh creates a new backup source for use with ccollect(1). +ccollect_add_source.sh creates a new backup source for use with ccollect(1). It copies the files from to the source directory with the hostname below -'$CCOLLECT_CONF/sources'. +'$CCOLLECT_CONF/sources'. It is designed to run on a backup server to create +new directories for new hosts. FILES @@ -41,8 +42,9 @@ very_verbose:: destination_base:: A link to the directory where to store the backups. Below this directory - `add_ccollect_source.sh` will create a directory with the hostname you - specified on the command line. + `ccollect_add_source.sh` will create a directory with the hostname you + specified on the command line. A common valua for `destination_base` is + '/home/server/backup'. source_prefix:: source_postfix:: @@ -54,7 +56,7 @@ source_postfix:: SEE ALSO -------- ccollect(1), ccollect-logwrapper(1), -delete_ccollect_source(1), list_ccollect_intervals(1) +ccollect_delete_source(1), ccollect_list_intervals(1) AUTHOR diff --git a/doc/man/ccollect_delete_source.text b/doc/man/ccollect_delete_source.text index b6e05bc..36bdf9c 100644 --- a/doc/man/ccollect_delete_source.text +++ b/doc/man/ccollect_delete_source.text @@ -1,21 +1,21 @@ -delete_ccollect_source(1) +ccollect_delete_source(1) ========================= Nico Schottelius NAME ---- -delete_ccollect_source - delete sources from ccollect(1) +ccollect_delete_source - delete sources from ccollect(1) SYNOPSIS -------- -'delete_ccollect_source.sh' [-d] [-f] +'ccollect_delete_source.sh' [-d] [-f] DESCRIPTION ----------- -delete_ccollect_source.sh deletes backup sources from ccollect(1) and optional +ccollect_delete_source.sh deletes backup sources from ccollect(1) and optional also the backups created for that source. OPTIONS @@ -36,8 +36,8 @@ $CCOLLECT_CONF/sources:: SEE ALSO -------- -add_ccollect_source(1), ccollect(1), -ccollect-logwrapper(1), list_ccollect_intervals(1) +ccollect_add_source(1), ccollect(1), +ccollect-logwrapper(1), ccollect_list_intervals(1) AUTHOR @@ -52,5 +52,5 @@ Main web site: http://unix.schottelius.org/ccollect/[] COPYING ------- -Copyright \(C) 2007 Nico Schottelius. Free use of this software is +Copyright \(C) 2007-2008 Nico Schottelius. Free use of this software is granted under the terms of the GNU General Public License Version 3 (GPLv3). diff --git a/tools/ccollect_delete_source.sh b/tools/ccollect_delete_source.sh index 8a811d3..d7dd2e1 100755 --- a/tools/ccollect_delete_source.sh +++ b/tools/ccollect_delete_source.sh @@ -1,9 +1,24 @@ #!/bin/sh -# Nico Schottelius -# 2007-08-16 -# Written for Netstream (www.netstream.ch) +# +# 2007-2008 Nico Schottelius (nico-ccollect at schottelius.org) +# +# This file is part of ccollect. +# +# ccollect is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# ccollect is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with ccollect. If not, see . +# +# 2007-08-16 Written for Netstream (www.netstream.ch) # Delete sources and their backups (optionally). -# Copying: GPLv3 (See file COPYING in top directory) # standard values CCOLLECT_CONF="${CCOLLECT_CONF:-/etc/ccollect}" @@ -37,11 +52,10 @@ force="" backups="" while [ $# -gt 0 ]; do - if [ "$params_possible" ]; then case "$1" in "-f"|"--force") - force=yes + force="-r" shift; continue ;; "-d"|"--destination") @@ -81,14 +95,14 @@ while [ $# -gt 0 ]; do fi if [ "$backups" ]; then - ddir=$(cd "${fullname}/destination" && pwd -P) || _exit_err "Cannot change to ${fullname}/destination" - _echo "Deleting ${ddir} ..." - rm -r "${ddir}" + ddir="$(cat "${fullname}/destination")" + addir="$(cd && pwd -P)" || _exit_err "Cannot change to ${ddir}" + _echo "Deleting ${addir} ..." + rm -r $force "${addir}" fi _echo "Deleting ${fullname} ..." - rm -r "${fullname}" - + rm -r $force "${fullname}" done exit 0