#! /bin/sh -e base=${CTF_BASE:-/var/lib/ctf} www=${CTF_BASE:-/var/www} pass=$base/pass img=$www/bkup.png time=$(date +%s) output=bkup-${time}.png if [ ! -e $img -o ! -e $pass ]; then exit 0 fi # clean up all other backup images if ls $www/bkup-*.png >/dev/null 2>&1 ; then rm $www/bkup-*.png fi # This is a tested method. #(cat $img; tar -cf - $base 2>/dev/null | gzip -c ) > $www/$output # This is not a tested method. (cat $img; tar -cvf - $base 2>/dev/null | gzip -c | rc4 3< $pass) > $www/$output echo $output