remove links to inside the source of ccollect

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-10-26 19:30:05 +02:00
parent 57066ac67e
commit 4a9e66f23a
1008 changed files with 1 additions and 52564 deletions

View file

@ -10,77 +10,24 @@ Additionally, the following other git ressources are available:
* [Mirror at github](http://github.com/telmich/ccollect/tree/master)
## Releases
* [[ccollect-0.8.tar.bz2]]
([browse source](ccollect-0.8))
([[Changes|ccollect-0.8/doc/changes/0.8]])
([[RPM|ccollect-0.8-0.noarch.rpm]])
<!-- -------------------------------------------------------- -->
* [[ccollect-0.8.tar.bz2]] ([[RPM|ccollect-0.8-0.noarch.rpm]])
* <A HREF="ccollect-0.7.1.tar.bz2">ccollect-0.7.1.tar.bz2</A>
(<A HREF="ccollect-0.7.1">browse source</A>)
(<A HREF="ccollect-0.7.1/doc/changes/0.7.1">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.7.0.tar.bz2">ccollect-0.7.0.tar.bz2</A>
(<A HREF="ccollect-0.7.0">browse source</A>)
(<A HREF="ccollect-0.7.0/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.6.2.tar.bz2">ccollect-0.6.2.tar.bz2</A>
(<A HREF="ccollect-0.6.2">browse source</A>)
(<A HREF="ccollect-0.6.2/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.6.1.tar.bz2">ccollect-0.6.1.tar.bz2</A>
(<A HREF="ccollect-0.6.1">browse source</A>)
(<A HREF="ccollect-0.6.1/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.6.tar.bz2">ccollect-0.6.tar.bz2</A>
(<A HREF="ccollect-0.6">browse source</A>)
(<A HREF="ccollect-0.6/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.5.2.tar.bz2">ccollect-0.5.2.tar.bz2</A>
(<A HREF="ccollect-0.5.2">browse source</A>)
(<A HREF="ccollect-0.5.2/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.5.1.tar.bz2">ccollect-0.5.1.tar.bz2</A>
(<A HREF="ccollect-0.5.1">browse source</A>)
(<A HREF="ccollect-0.5.1/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.5.tar.bz2">ccollect-0.5.tar.bz2</A>
(<A HREF="ccollect-0.5">browse source</A>)
(<A HREF="ccollect-0.5/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.4.2.tar.bz2">ccollect-0.4.2.tar.bz2</A>
(<A HREF="ccollect-0.4.2">browse source</A>)
(<A HREF="ccollect-0.4.2/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.4.1.tar.bz2">ccollect-0.4.1.tar.bz2</A>
(<A HREF="ccollect-0.4.1">browse source</A>)
(<A HREF="ccollect-0.4.1/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.4.tar.bz2">ccollect-0.4.tar.bz2</A>
(<A HREF="ccollect-0.4">browse source</A>)
(<A HREF="ccollect-0.4/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.3.3.tar.bz2">ccollect-0.3.3.tar.bz2</A>
(<A HREF="ccollect-0.3.3">browse source</A>)
(<A HREF="ccollect-0.3.3/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.3.2.tar.bz2">ccollect-0.3.2.tar.bz2</A>
(<A HREF="ccollect-0.3.2">browse source</A>)
(<A HREF="ccollect-0.3.2/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.3.1.tar.bz2">ccollect-0.3.1.tar.bz2</A>
(<A HREF="ccollect-0.3.1">browse source</A>)
(<A HREF="ccollect-0.3.1/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.3.tar.bz2">ccollect-0.3.tar.bz2</A>
(<A HREF="ccollect-0.3">browse source</A>)
(<A HREF="ccollect-0.3/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.2.tar.bz2">ccollect-0.2.tar.bz2</A>
(<A HREF="ccollect-0.2">browse source</A>)
(<A HREF="ccollect-0.2/doc/CHANGES">Changes</A>)
<!-- -------------------------------------------------------- -->
* <A HREF="ccollect-0.1.tar.bz2">ccollect-0.1.tar.bz2</A>
(<A HREF="ccollect-0.1">browse source</A>)
### Gentoo

View file

@ -1 +0,0 @@
conf/sources/*/destination/*

View file

@ -1,47 +0,0 @@
--------------------------------------------------------------------------------
ccollect.sh, Nico Schottelius, 2005-12-07
--------------------------------------------------------------------------------
0. Runtime options
1. General configuration
2. Source configuration
--------------------------------------------------------------------------------
0. Runtime options
ccollect looks for its configuration in /etc/ccollect or, if set, in
the directory specified in $CCOLLECT_CONF.
There are also some self explaining parameters you can pass to ccollect, simply use
"ccollect.sh --help" for info.
The "intervall" is used to know how many backups to keep.
--------------------------------------------------------------------------------
1. General configuration
The general configuration can be found below $CCOLLECT_CONF/defaults or /etc/ccollect/defaults.
1.2. Intervall definition
Below this directory should be:
intervalls/<intervall name>
The number in this file tells ccollect how many versions to keep.
--------------------------------------------------------------------------------
2. Source configuration
Each source configuration exists below $CCOLLECT_CONF/sources/$name.
The name describes the source.
Each source has at least
- source (a text file containing the path to backup)
- destination (a link to the directory we should backup to)
Additionally a source may have the following files:
- verbose whether to be verbose
- exclude excludes for rsync. One exclude specification on each line

View file

@ -1,11 +0,0 @@
Hard links are such a nice thing ;-)
[10:53] srsyg01:sources% du -sh ~/backupdir
4.6M /home/nico/backupdir
[10:53] srsyg01:sources% du -sh ~/backupdir/*
4.1M /home/nico/backupdir/daily.2005-12-08-10:52.28456
4.1M /home/nico/backupdir/daily.2005-12-08-10:53.28484
4.1M /home/nico/backupdir/daily.2005-12-08-10:53.28507
4.1M /home/nico/backupdir/daily.2005-12-08-10:53.28531
4.1M /home/nico/backupdir/daily.2005-12-08-10:53.28554
4.1M /home/nico/backupdir/daily.2005-12-08-10:53.28577

View file

@ -1,5 +0,0 @@
--------------------------------------------------------------------------------
ccollect.sh, Nico Schottelius, 2005-12-08
--------------------------------------------------------------------------------
Simply copy it to a directory in your $PATH.

View file

@ -1,73 +0,0 @@
--------------------------------------------------------------------------------
ccollect.sh, Nico Schottelius, 2005-12-06
--------------------------------------------------------------------------------
ccollect backups data from local or remote hosts to your local harddisk.
You can retriev the latest version of ccollect at [0].
ccollect was inspired by rsnapshot [1], which had some problems:
- configuration parameters had to be TAB seperated
- you could not specify exclude lists differently for every source
- no parallel execution
- I didn't like the configuration at all, so I used the cconfig style [2].
[0]: ccollect: http://linux.schottelius.org/ccollect/
[1]: rsnapshot: htt://www.rsnapshot.org/
[2]: cconfig: http://nico.schotteli.us/papers/linux/cconfig/
--------------------------------------------------------------------------------
$CCOLLECT_CONF/
-> Directories, which are so called 'backup-definitions'
$dir/
source -> file with the source
destination -> link to the destination
exclude -> \n seperated
--------------------------------------------------------------------------------
source - a rsync compatible source (one liner)
For instance:
backup_user@foreign_host:/home/server/video
or
rsync://[USER@]HOST[:PORT]/SRC
Have a look at rsync(1).
--------------------------------------------------------------------------------
verbose - should we log verbose or silent
If this file exists in the source specification -v will be passed to rsync.
--------------------------------------------------------------------------------
exclude - a new line seperated list of paths to exclude
--------------------------------------------------------------------------------
destination - a link to the destination directory
--------------------------------------------------------------------------------
intervalls/ - subdirectory of source or defaults
Each file below this directory describe an intervalls.
--------------------------------------------------------------------------------
log - link to file we should log to
If a backup source exists (the cconfig dir exists) all logs for this
source will be written to this file. General errors and errors of
non existent or broken configuration will be logged to stderr.
I do not think it is senseful to have one logfile for all sources, as
the sources can be backuped in parallel and you would not be able to
distinguish the different log processes very good then.
If you REALLY REALLY REALLY want to have all in one logfile, simply
link all "log" entries to the same file, output will be appended.
--------------------------------------------------------------------------------

View file

@ -1,12 +0,0 @@
--------------------------------------------------------------------------------
ccollect.sh, Nico Schottelius, 2005-12-06 (updated: 2005-12-07)
Requirements
--------------------------------------------------------------------------------
ccollect needs the following packages:
- a bourne shell (/bin/sh) compatible shell
- bc
- cp with support for hard links (cp -al is used)
- rsync
- ssh if you want to use rsync over ssh

View file

@ -1,11 +0,0 @@
- write a manpage
- write a simple manual
- implement verbosity
o general, very verbose (set -x)
- implement general log
- implement source specific log
- implement parallel execution
DONE
- implement verbosity
o per source (-v to rsync)

View file

@ -1,288 +0,0 @@
#!/bin/sh
# Nico Schottelius
# written for SyGroup (www.sygroup.ch)
# Date: Mon Nov 14 11:45:11 CET 2005
# Last Modified:
#
# temporary as long as inofficial
#
CCOLLECT_CONF=$HOME/crsnapshot/conf
#
# where to find our configuration and temporary file
#
CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect}
CSOURCES=$CCOLLECT_CONF/sources
CDEFAULTS=$CCOLLECT_CONF/defaults
TMP=$(mktemp /tmp/$(basename $0).XXXXXX)
WE=$(basename $0)
#
# catch signals
#
trap "rm -f \"$TMP\"" 1 2 15
#
# errors!
#
errecho()
{
echo "|E> Error: $@" >&2
}
#
# Tell how to use us
#
usage()
{
echo "$WE: <intervall name> [args] <sources to backup>"
echo ""
echo " Nico Schottelius (nico-linux-ccollect schottelius.org) - 2005-12-06"
echo ""
echo " Backup data pseudo incremental"
echo ""
echo " -h, --help: Show this help screen"
echo " -p, --parallel: Parellize backup process"
echo " -a, --all: Backup all sources specified in $CSOURCES"
echo ""
echo " Retrieve latest ccollect at http://linux.schottelius.org/ccollect/."
echo ""
exit 0
}
#
# need at least intervall and one source or --all
#
if [ $# -lt 2 ]; then
usage
fi
#
# Filter arguments
#
INTERVALL=$1; shift
i=1
no_shares=0
while [ $i -le $# ]; do
eval arg=\$$i
if [ "$NO_MORE_ARGS" = 1 ]; then
eval share_${no_shares}=\"$arg\"
no_shares=$[$no_shares+1]
else
case $arg in
-a|--all)
ALL=1
;;
-p|--parallel)
PARALLEL=1
;;
-h|--help)
usage
;;
--)
NO_MORE_ARGS=1
;;
*)
eval share_${no_shares}=\"$arg\"
no_shares=$[$no_shares+1]
;;
esac
fi
i=$[$i+1]
done
#
# Look, if we should take ALL sources
#
if [ "$ALL" = 1 ]; then
# reset everything specified before
no_shares=0
#
# get entries from sources
#
cwd=$(pwd)
cd $CSOURCES;
ls > "$TMP"
while read tmp; do
eval share_${no_shares}=\"$tmp\"
no_shares=$[$no_shares+1]
done < "$TMP"
fi
#
# Need at least ONE source to backup
#
if [ "$no_shares" -lt 1 ]; then
usage
else
echo "/o> $WE: Beginning backup using intervall $INTERVALL"
fi
#
# check default configuration
#
D_FILE_INTERVALL="$CDEFAULTS/intervalls/$INTERVALL"
D_INTERVALL=$(cat $D_FILE_INTERVALL 2>/dev/null)
#
# Let's do the backup
#
i=0
while [ "$i" -lt "$no_shares" ]; do
#
# Standard locations
#
eval name=\$share_${i}
backup="$CSOURCES/$name"
c_source="$backup/source"
c_dest="$backup/destination"
c_exclude="$backup/exclude"
c_verbose="$backup/verbose"
echo "/=> Beginning to backup \"$name\" ..."
i=$[$i+1]
#
# Standard configuration checks
#
if [ ! -e "$backup" ]; then
errecho "Source \"$name\" does not exist."
continue
fi
if [ ! -d "$backup" ]; then
errecho "\"$name\" is not a cconfig-directory. Skipping."
continue
fi
#
# intervall definiition: First try source specific, fallback to default
#
c_intervall="$(cat "$backup/intervalls/$INTERVALL" 2>/dev/null)"
if [ -z "$c_intervall" ]; then
c_intervall=$D_INTERVALL
if [ -z "$c_intervall" ]; then
errecho "Default and source specific intervall missing. Skipping."
continue
fi
fi
#
# standard rsync options
#
VERBOSE=""
EXCLUDE=""
#
# next configuration checks
#
if [ ! -f "$c_source" ]; then
echo "|-> Source description $c_source is not a file. Skipping."
continue
else
source=$(cat "$c_source")
if [ $? -ne 0 ]; then
echo "|-> Skipping: Source $c_source is not readable"
continue
fi
fi
if [ ! -d "$c_dest" ]; then
errecho "Destination $c_dest does not link to a directory. Skipping"
continue
fi
# exclude
if [ -f "$c_exclude" ]; then
EXCLUDE="--exclude-from=$c_exclude"
fi
# verbose
if [ -f "$c_verbose" ]; then
VERBOSE="-v"
fi
#
# check if maximum number of backups is reached, if so remove
#
# the created directories are named $INTERVALL.$DATE
count=$(ls -d "$c_dest/${INTERVALL}."?* 2>/dev/null | wc -l)
echo "|-> $count backup(s) already exist, keeping $c_intervall backup(s)."
if [ "$count" -ge "$c_intervall" ]; then
substract=$(echo $c_intervall - 1 | bc)
remove=$(echo $count - $substract | bc)
echo "|-> Removing $remove backup(s)..."
ls -d "$c_dest/${INTERVALL}."?* | sort -n | head -n $remove > "$TMP"
while read to_remove; do
dir="$to_remove"
echo "|-> Removing $dir ..."
rm -rf "$dir"
done < "$TMP"
fi
#
# clone the old directory with hardlinks
#
destination_date=$(date +%Y-%m-%d-%H:%M)
destination_dir="$c_dest/${INTERVALL}.${destination_date}.$$"
last_dir=$(ls -d "$c_dest/${INTERVALL}."?* 2>/dev/null | sort -n | tail -n 1)
# only copy if a directory exists
if [ "$last_dir" ]; then
# echo cp -al "$last_dir" "$destination_dir"
cp $VERBOSE -al "$last_dir" "$destination_dir"
else
mkdir "$destination_dir"
fi
if [ $? -ne 0 ]; then
errecho "Creating/cloning backup directory failed. Skipping backup."
continue
fi
#
# the rsync part
# options stolen shameless from rsnapshot
#
rsync -a $VERBOSE --delete --numeric-ids --relative --delete-excluded \
"$EXCLUDE" $EXCLUDE "$source" "$destination_dir"
if [ $? -ne 0 ]; then
errecho "rsync failed, backup most likely broken"
continue
fi
echo "\=> Successfully finished backup of \"$name\"."
done
#
# Be a good parent and wait for our children, if they are running wild parallel
#
if [ "$PARALLEL" = 1 ]; then
wait
fi
rm -f "$TMP"
echo "\o> Finished $WE."

View file

@ -1 +0,0 @@
/home/nico/backupdir

View file

@ -1,3 +0,0 @@
openvpn-2.0.1.tar.gz
nicht_reinnehmen
etwas mit leerzeichenli

View file

@ -1 +0,0 @@
nico@creme.schottelius.org:bin

View file

@ -1,3 +0,0 @@
openvpn-2.0.1.tar.gz
nicht_reinnehmen
etwas mit leerzeichenli

View file

@ -1 +0,0 @@
tar cvfj ccollect-0.1.tar.bz2 --exclude=.git --exclude="conf/sources/*/destination/*" ccollect-0.1

View file

@ -1,2 +0,0 @@
conf/sources/*/destination/*
doc/old

View file

@ -1,25 +0,0 @@
#
# ccollect
# Nico Schottelius, Fri Jan 13 12:13:08 CET 2006
#
INSTALL=install
CCOLLECT=ccollect.sh
LN=ln -sf
prefix=/usr/packages/ccollect-0.2
bindir=$(prefix)/bin
destination=$(bindir)/$(CCOLLECT)
path_dir=/usr/local/bin
path_destination=$(path_dir)/$(CCOLLECT)
all:
@echo "Nothing to make, make install."
documentation:
@asciidoc -n -o doc/ccollect.html doc/ccollect.text
install:
$(INSTALL) -D -m 0755 -s $(CCOLLECT) $(destination)
$(LN) $(destination) $(path_destination)

View file

@ -1,22 +0,0 @@
--------------------------------------------------------------------------------
ccollect.sh, Nico Schottelius, 2005-12-06
--------------------------------------------------------------------------------
ccollect backups data from local or remote hosts to your local harddisk.
You can retriev the latest version of ccollect at [0].
doc/ccollect.text Manual in text format
doc/ccollect.html Manual in xhtml
ccollect was inspired by rsnapshot [1], which had some problems:
- configuration parameters had to be TAB seperated
- you could not specify exclude lists differently for every source
- no parallel execution
- I didn't like the configuration at all, so I used the cconfig style [2].
[0]: ccollect: http://linux.schottelius.org/ccollect/
[1]: rsnapshot: htt://www.rsnapshot.org/
[2]: cconfig: http://nico.schotteli.us/papers/linux/cconfig/

View file

@ -1,344 +0,0 @@
#!/bin/sh
# Nico Schottelius
# written for SyGroup (www.sygroup.ch)
# Date: Mon Nov 14 11:45:11 CET 2005
# Last Modified: (See ls -l or git)
#
# where to find our configuration and temporary file
#
CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect}
CSOURCES=$CCOLLECT_CONF/sources
CDEFAULTS=$CCOLLECT_CONF/defaults
TMP=$(mktemp /tmp/$(basename $0).XXXXXX)
WE=$(basename $0)
VERSION=0.2
RELEASE="2006-01-13"
#
# unset parallel execution
#
PARALLEL=""
#
# catch signals
#
trap "rm -f \"$TMP\"" 1 2 15
add_name()
{
sed "s/^/\[$name\] /"
}
#
# Tell how to use us
#
usage()
{
echo "$WE: <intervall name> [args] <sources to backup>"
echo ""
echo " Nico Schottelius (nico-linux-ccollect schottelius.org) - 2005-12-06"
echo ""
echo " Backup data pseudo incremental"
echo ""
echo " -h, --help: Show this help screen"
echo " -p, --parallel: Parellize backup process"
echo " -a, --all: Backup all sources specified in $CSOURCES"
echo " -v, --verbose: Be very verbose."
echo ""
echo " Retrieve latest ccollect at http://linux.schottelius.org/ccollect/."
echo ""
echo " Version: $VERSION ($RELEASE, Black Friday Release)"
exit 0
}
#
# need at least intervall and one source or --all
#
if [ $# -lt 2 ]; then
usage
fi
#
# check for configuraton directory
#
if [ ! -d "$CCOLLECT_CONF" ]; then
echo "Configuration \"$CCOLLECT_CONF\" not found."
exit 1
fi
#
# Filter arguments
#
INTERVALL=$1; shift
i=1
no_shares=0
while [ $i -le $# ]; do
eval arg=\$$i
if [ "$NO_MORE_ARGS" = 1 ]; then
eval share_${no_shares}=\"$arg\"
no_shares=$[$no_shares+1]
else
case $arg in
-a|--all)
ALL=1
;;
-v|--verbose)
VERBOSE=1
;;
-p|--parallel)
PARALLEL="1"
;;
-h|--help)
usage
;;
--)
NO_MORE_ARGS=1
;;
*)
eval share_${no_shares}=\"$arg\"
no_shares=$[$no_shares+1]
;;
esac
fi
i=$[$i+1]
done
#
# be really really really verbose
#
if [ "$VERBOSE" = 1 ]; then
set -x
fi
#
# Look, if we should take ALL sources
#
if [ "$ALL" = 1 ]; then
# reset everything specified before
no_shares=0
#
# get entries from sources
#
cwd=$(pwd)
cd "$CSOURCES";
ls > "$TMP"
while read tmp; do
eval share_${no_shares}=\"$tmp\"
no_shares=$[$no_shares+1]
done < "$TMP"
fi
#
# Need at least ONE source to backup
#
if [ "$no_shares" -lt 1 ]; then
usage
else
echo "==> $WE: Beginning backup using intervall $INTERVALL <=="
fi
#
# check default configuration
#
D_FILE_INTERVALL="$CDEFAULTS/intervalls/$INTERVALL"
D_INTERVALL=$(cat $D_FILE_INTERVALL 2>/dev/null)
#
# Let's do the backup
#
i=0
while [ "$i" -lt "$no_shares" ]; do
#
# Get current share
#
eval name=\$share_${i}
i=$[$i+1]
export name
#
# start ourself, if we want parallel execution
#
if [ "$PARALLEL" ]; then
$0 "$INTERVALL" "$name" &
continue
fi
#
# Start subshell for easy log editing
#
(
#
# Stderr to stdout, so we can produce nice logs
#
exec 2>&1
#
# Standard locations
#
backup="$CSOURCES/$name"
c_source="$backup/source"
c_dest="$backup/destination"
c_exclude="$backup/exclude"
c_verbose="$backup/verbose"
c_rsync_extra="$backup/rsync_options"
echo "Beginning to backup this source ..."
#
# Standard configuration checks
#
if [ ! -e "$backup" ]; then
echo "Source does not exist."
exit 1
fi
if [ ! -d "$backup" ]; then
echo "\"$name\" is not a cconfig-directory. Skipping."
exit 1
fi
#
# intervall definition: First try source specific, fallback to default
#
c_intervall="$(cat "$backup/intervalls/$INTERVALL" 2>/dev/null)"
if [ -z "$c_intervall" ]; then
c_intervall=$D_INTERVALL
if [ -z "$c_intervall" ]; then
echo "Default and source specific intervall missing. Skipping."
exit 1
fi
fi
#
# standard rsync options
#
VERBOSE=""
EXCLUDE=""
RSYNC_EXTRA=""
#
# next configuration checks
#
if [ ! -f "$c_source" ]; then
echo "Source description $c_source is not a file. Skipping."
exit 1
else
source=$(cat "$c_source")
if [ $? -ne 0 ]; then
echo "Skipping: Source $c_source is not readable"
exit 1
fi
fi
if [ ! -d "$c_dest" ]; then
echo "Destination $c_dest does not link to a directory. Skipping"
exit 1
fi
# exclude
if [ -f "$c_exclude" ]; then
EXCLUDE="--exclude-from=$c_exclude"
fi
# extra options for rsync
if [ -f "$c_rsync_extra" ]; then
RSYNC_EXTRA="$(cat "$c_rsync_extra")"
fi
# verbose
if [ -f "$c_verbose" ]; then
VERBOSE="-v"
fi
#
# check if maximum number of backups is reached, if so remove
#
# the created directories are named $INTERVALL.$DA
count=$(ls -d "$c_dest/${INTERVALL}."?* 2>/dev/null | wc -l)
echo "Currently $count backup(s) exist, total keeping $c_intervall backup(s)."
if [ "$count" -ge "$c_intervall" ]; then
substract=$(echo $c_intervall - 1 | bc)
remove=$(echo $count - $substract | bc)
echo "Removing $remove backup(s)..."
ls -d "$c_dest/${INTERVALL}."?* | sort -n | head -n $remove > "$TMP"
while read to_remove; do
dir="$to_remove"
echo "Removing $dir ..."
rm -rf "$dir"
done < "$TMP"
fi
#
# clone the old directory with hardlinks
#
destination_date=$(date +%Y-%m-%d-%H:%M)
destination_dir="$c_dest/${INTERVALL}.${destination_date}.$$"
last_dir=$(ls -d "$c_dest/${INTERVALL}."?* 2>/dev/null | sort -n | tail -n 1)
# give some info
echo "Beginning to backup, this may take some time..."
# only copy if a directory exists
if [ "$last_dir" ]; then
echo "Hard linking..."
cp -al $VERBOSE "$last_dir" "$destination_dir"
else
echo "Creating $destination_dir"
mkdir "$destination_dir"
fi
if [ $? -ne 0 ]; then
echo "Creating/cloning backup directory failed. Skipping backup."
exit 1
fi
#
# the rsync part
# options partly stolen from rsnapshot
#
echo "Transferring files..."
rsync -a $VERBOSE $RSYNC_EXTRA $EXCLUDE \
--delete --numeric-ids --relative --delete-excluded \
"$source" "$destination_dir"
if [ "$?" -ne 0 ]; then
echo "rsync failed, backup may be broken (see rsync errors)"
exit 1
fi
echo "Successfully finished backup."
) | add_name
done
#
# Be a good parent and wait for our children, if they are running wild parallel
#
if [ "$PARALLEL" ]; then
echo "Waiting for child jobs to complete..."
wait
fi
rm -f "$TMP"
echo "==> Finished $WE <=="

View file

@ -1 +0,0 @@
/home/nico/backupdir

View file

@ -1 +0,0 @@
nico@creme.schottelius.org:bin

View file

@ -1,3 +0,0 @@
openvpn-2.0.1.tar.gz
nicht_reinnehmen
etwas mit leerzeichenli

View file

@ -1,3 +0,0 @@
openvpn-2.0.1.tar.gz
nicht_reinnehmen
etwas mit leerzeichenli

View file

@ -1 +0,0 @@
/home/nico/backupdir/vpn

View file

@ -1 +0,0 @@
/home/nico/vpn/

View file

@ -1,7 +0,0 @@
0.1 to 0.2:
* Added plausibility check
* Updated and made documentation readable
* implemented verbose option
* Fixed double exclude parameter bug
* Added much better documentation (asciidoc)
* added rsync extra parameter option

View file

@ -1,11 +0,0 @@
- write a manpage
DONE
- implement verbosity
o per source (-v to rsync)
o general, very verbose (set -x)
- write a simple manual
- implement parallel execution
- implement general log
- implement source specific log (canceled)
- the name prefix is currently somehow inconsistent

View file

@ -1,571 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 7.0.2" />
<style type="text/css">
/* Debug borders */
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
/*
border: 1px solid red;
*/
}
body {
margin: 1em 5% 1em 5%;
}
a { color: blue; }
a:visited { color: fuchsia; }
em {
font-style: italic;
}
strong {
font-weight: bold;
}
tt {
color: navy;
}
h1, h2, h3, h4, h5, h6 {
color: #527bbd;
font-family: sans-serif;
margin-top: 1.2em;
margin-bottom: 0.5em;
line-height: 1.3;
}
h1 {
border-bottom: 2px solid silver;
}
h2 {
border-bottom: 2px solid silver;
padding-top: 0.5em;
}
div.sectionbody {
font-family: serif;
margin-left: 0;
}
hr {
border: 1px solid silver;
}
p {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
pre {
padding: 0;
margin: 0;
}
span#author {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
font-size: 1.2em;
}
span#email {
}
span#revision {
font-family: sans-serif;
}
div#footer {
font-family: sans-serif;
font-size: small;
border-top: 2px solid silver;
padding-top: 0.5em;
margin-top: 4.0em;
}
div#footer-text {
float: left;
padding-bottom: 0.5em;
}
div#footer-badges {
float: right;
padding-bottom: 0.5em;
}
div#preamble,
div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
div.admonitionblock {
margin-right: 10%;
margin-top: 1.5em;
margin-bottom: 1.5em;
}
div.admonitionblock {
margin-top: 2.5em;
margin-bottom: 2.5em;
}
div.content { /* Block element content. */
padding: 0;
}
/* Block element titles. */
div.title, caption.title {
font-family: sans-serif;
font-weight: bold;
text-align: left;
margin-top: 1.0em;
margin-bottom: 0.5em;
}
div.title + * {
margin-top: 0;
}
td div.title:first-child {
margin-top: 0.0em;
}
div.content div.title:first-child {
margin-top: 0.0em;
}
div.content + div.title {
margin-top: 0.0em;
}
div.sidebarblock > div.content {
background: #ffffee;
border: 1px solid silver;
padding: 0.5em;
}
div.listingblock > div.content {
border: 1px solid silver;
background: #f4f4f4;
padding: 0.5em;
}
div.quoteblock > div.content {
padding-left: 2.0em;
}
div.quoteblock .attribution {
text-align: right;
}
div.admonitionblock .icon {
vertical-align: top;
font-size: 1.1em;
font-weight: bold;
text-decoration: underline;
color: #527bbd;
padding-right: 0.5em;
}
div.admonitionblock td.content {
padding-left: 0.5em;
border-left: 2px solid silver;
}
div.exampleblock > div.content {
border-left: 2px solid silver;
padding: 0.5em;
}
div.verseblock div.content {
white-space: pre;
}
div.imageblock div.content { padding-left: 0; }
div.imageblock img { border: 1px solid silver; }
span.image img { border-style: none; }
dl {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
dt {
margin-top: 0.5em;
margin-bottom: 0;
font-style: italic;
}
dd > *:first-child {
margin-top: 0;
}
ul, ol {
list-style-position: outside;
}
ol.olist2 {
list-style-type: lower-alpha;
}
div.tableblock > table {
border-color: #527bbd;
border-width: 3px;
}
thead {
font-family: sans-serif;
font-weight: bold;
}
tfoot {
font-weight: bold;
}
div.hlist {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
td.hlist1 {
vertical-align: top;
font-style: italic;
padding-right: 0.8em;
}
td.hlist2 {
vertical-align: top;
}
@media print {
div#footer-badges { display: none; }
}
/* Workarounds for IE6's broken and incomplete CSS2. */
div.sidebar-content {
background: #ffffee;
border: 1px solid silver;
padding: 0.5em;
}
div.sidebar-title, div.image-title {
font-family: sans-serif;
font-weight: bold;
margin-top: 0.0em;
margin-bottom: 0.5em;
}
div.listingblock div.content {
border: 1px solid silver;
background: #f4f4f4;
padding: 0.5em;
}
div.quoteblock-content {
padding-left: 2.0em;
}
div.exampleblock-content {
border-left: 2px solid silver;
padding-left: 0.5em;
}
</style>
<title>ccollect - Installing, Configuring and Using</title>
</head>
<body>
<div id="header">
<h1>ccollect - Installing, Configuring and Using</h1>
<span id="author">Nico Schottelius</span><br />
<span id="email"><tt>&lt;<a href="mailto:nico-linux-ccollect__@__schottelius.org">nico-linux-ccollect__@__schottelius.org</a>&gt;</tt></span><br />
<span id="revision">version 0.2,</span>
2005-01-13
</div>
<div id="preamble">
<div class="sectionbody">
<p>(pseudo) incremental backup
with different exclude lists
using hardlinks and <tt>rsync</tt></p>
</div>
</div>
<h2>1. Introduction</h2>
<div class="sectionbody">
<p>ccollect is a backup utitily written in the sh-scripting language.
It does not depend on a specific shell, only <tt>/bin/sh</tt> needs to be
bourne shell compatibel (like <em>dash</em>, <em>zsh</em> or <em>bash</em>).</p>
<h3>1.1. Why you can only backup TO localhost</h3>
<p>While thinking about the design of ccollect, I thought about enabling
backup to <strong>remote</strong> hosts. Though this sounds like a nice feature
(<em>Backup my notebook to the server now.</em>), it is in my opinion a
bad idea to backup to a remote host, because you have to open
security at your backup host. Think of the following situation: You backup
your farm of webservers <strong>to</strong> a backup host somewhere else. One of
your webservers gets compromised, then your backup server will be compromised,
too. Think of it the other way round: The backup server (now behind a
firewall using NAT and strong firewall rules) connects to the
webservers and pulls the data to it. If someone gets access to the
webserver, the person will perhaps not even see your machine. If
he/she sees that there are connections from a host to the compromised
machine, he/she will not be able to login to the backup machine.
All other backups are still secure.</p>
</div>
<h2>2. Requirements</h2>
<div class="sectionbody">
<h3>2.1. Installing ccollect</h3>
<p>For the installation, you need at least
- either <em>cp</em> and <em>chmod</em> or <em>install
- for more comfort: 'make</em>
- for rebuilding the generated documentation: additionally <em>asciidoc</em></p>
<h3>2.2. Using ccollect</h3>
<div class="title">When running ccollect, it requires the following tools installed:</div><ul>
<li>
<p>
<tt>bc</tt>
</p>
</li>
<li>
<p>
<tt>cp</tt> with support for hard links (<em>cp -al</em>)
</p>
</li>
<li>
<p>
<tt>rsync</tt>
</p>
</li>
<li>
<p>
<tt>ssh</tt> (if you want to use rsync over ssh, which is recommened for security)
</p>
</li>
</ul>
</div>
<h2>3. Installing</h2>
<div class="sectionbody">
<p>Either type <em>make install</em> or simply copy it to a directory in your
$PATH and execute <em>chmod <strong>0755</strong> /path/to/ccollect.sh</em>.</p>
</div>
<h2>4. Configuring</h2>
<div class="sectionbody">
<h3>4.1. Runtime options</h3>
<p><tt>ccollect</tt> looks for its configuration in <em>/etc/ccollect</em> or, if set, in
the directory specified by the variable <em>$CCOLLECT_CONF</em>
(use <em>CCOLLECT_CONF=/your/config/dir ccollect.sh</em> on the shell).</p>
<p>When you start <tt>ccollect</tt>, you have either to specify which intervall
to backup (daily, weekly, yearly; you can specify the names yourself, see below).</p>
<p>The intervall is used to specify how many backups to keep.</p>
<p>There are also some self explaining parameters you can pass to ccollect, simply use
"ccollect.sh &#8212;help" for info.</p>
<h3>4.2. General configuration</h3>
<p>The general configuration can be found below $CCOLLECT_CONF/defaults or
/etc/ccollect/defaults. All options specified here are generally valid for
all source definitions. Though the values can be overwritten in the source
configuration.</p>
<p>All configuration entries are plain-text (use UTF-8 if you use
non ASCII characters) files.</p>
<h4>4.2.1. Intervall definition</h4>
<p>The intervall definition can be found below
<em>$CCOLLECT_CONF/defaults/intervalls/</em> or <em>/etc/ccollect/defaults/intervalls</em>.
Every file below this directory specifies an intervall. The name of the file is the
name of the intervall: <tt>intervalls/<em>&lt;intervall name&gt;</em></tt>.</p>
<p>The content of this file should be a single line containing a number.
This number defines how many versions of this intervall to keep.</p>
<p>Example:</p>
<div class="listingblock">
<div class="content">
<pre><tt> [10:23] zaphodbeeblebrox:ccollect-0.2% ls -l conf/defaults/intervalls/
insgesamt 12
-rw-r--r-- 1 nico users 3 2005-12-08 10:24 daily
-rw-r--r-- 1 nico users 3 2005-12-08 11:36 monthly
-rw-r--r-- 1 nico users 2 2005-12-08 11:36 weekly