/home/daten/net-tex.de/current/code/dump.sh.html
DATE=`date +%y%m%d`
DAYOFMONTH=`date +%d`
#use dumplevel 0 in first week of month, 1 else
if [ "$DAYOFMONTH" -le 7 ]; then
LEVEL=0
else
LEVEL=1
fi
echo " dumping at level: $LEVEL"
#passphrase for mcrypt, might be insecure this way
echo " enter passphrase for encryption:"
read PASS
#create filename of current date and level
FILENAME=$DATE-$LEVEL
#clean ~ (remove core-dumps)
find /home -name "*.core" -printx | xargs rm -rf
#dump
umount /home
dump -$LEVEL -auf $FILENAME /dev/cgd0d
mount /dev/cgd0d /home
#encrypt
mcrypt -k $PASS $PASS -a rijndael-256 $FILENAME
#create sha1 checksums
sha1 $FILENAME >> sha1list
sha1 $FILENAME.nc >> sha1list
chown stefan *
#wipe out unencrypted file using bummsfallera bcwipe
/root/bin/bcwipe -f -md $FILENAME
# sudo-ing to 'stefan' to use his ssh-key identification w/o passwd
# scp-ing it to remote host with streamer
sudo -u stefan scp $FILENAME stefan@@192.168.2.1:/usr/home/back/tapeit/current/