Name can be different. Default is to backup as root

This commit is contained in:
Nico Schottelius 2007-08-07 10:42:42 +02:00
parent 4b77c5ba85
commit d0a417c3bd

View file

@ -25,14 +25,16 @@ _exit_err()
} }
# argv # argv
if [ $# -ne 2 ]; then if [ $# -ne 3 ]; then
_echo "Arguments needed: <name of the server> <where to store backup>" _echo "<name of the ccollect-source> <servername> <destination>"
_echo "Example: \"my-notebook\" \"192.168.42.42\" \"/home/server/backup/my-notebook\""
exit 1 exit 1
fi fi
name="$1" name="$1"
source="$2"
destination="$3"
fullname="${CSOURCES}/${name}" fullname="${CSOURCES}/${name}"
destination="$2"
# Tests # Tests
if [ -e "${fullname}" ]; then if [ -e "${fullname}" ]; then
@ -40,14 +42,14 @@ if [ -e "${fullname}" ]; then
exit 2 exit 2
fi fi
_echo "Trying to reach ${name} ..." _echo "Trying to reach ${source} ..."
ping -c1 "${name}" || _exit_err "Cannot reach ${name}. Aborting." ping -c1 "${source}" || _exit_err "Cannot reach ${source}. Aborting."
# Create # Create
_echo "Creating ${fullname} ..." _echo "Creating ${fullname} ..."
mkdir -p "${fullname}" || exit 3 mkdir -p "${fullname}" || exit 3
echo "${name}:/" > "${fullname}/source" echo "root@${source}:/" > "${fullname}/source"
cat << eof > "${fullname}/exclude" || exit 4 cat << eof > "${fullname}/exclude" || exit 4
/dev/* /dev/*
/proc/* /proc/*
@ -69,5 +71,5 @@ ln -s "${destination}" "${fullname}/destination" || \
_exit_err "Failed to link \"${destination}\" to \"${fullname}/destination\"" _exit_err "Failed to link \"${destination}\" to \"${fullname}/destination\""
# finish # finish
_echo "Added some default values, please verify ${fullname}." _echo "Added some default values, please verify \"${fullname}\"."
_echo "Finished." _echo "Finished."