From a08580fe7e45315adfa6d3c73e4f9316bd9a672f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Aug 2009 13:39:39 +0200 Subject: [PATCH] add tool to archive the configuration Signed-off-by: Nico Schottelius --- tools/ccollect_archive_config.sh | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 tools/ccollect_archive_config.sh diff --git a/tools/ccollect_archive_config.sh b/tools/ccollect_archive_config.sh new file mode 100755 index 0000000..f42c88a --- /dev/null +++ b/tools/ccollect_archive_config.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# +# 2009 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 . +# +# Write a tar containing the configuration +# + +# standard values +CCOLLECT_CONF="${CCOLLECT_CONF:-/etc/ccollect}" + +self="$(basename $0)" + +# functions first +_echo() +{ + echo "${self}> $@" +} + +_exit_err() +{ + _echo "$@" + rm -f "$TMP" + exit 1 +} + +# argv +if [ $# -ne 1 ]; then + _echo "${self} " + _exit_err "Exiting." +fi + +file="$1" + +_echo "Creating $file ..." + +[ -d "${CCOLLECT_CONF}" ] || _exit_err "No configuration in $CCOLLECT_CONF" + +tar cf "$file" "${CCOLLECT_CONF}"