#!/bin/bash
# http://heap.altlinux.org/issues/compact ... index.html
START_TIME=$(date +%s)
suffix=`eval date +%Y-%m-%d_%H:%M:%S`
filename=$suffix
echo "backup file name" $filename
tar -zcf /home/bkp/home.$filename.tar.gz /home/mike
tar -zcf /home/bkp/etc.$filename.tar.gz /etc/
tar -zcf /home/bkp/scan.$filename.tar.gz /home/filestrash/scans/
END_TIME=$(date +%s)
DIFF=$(( $END_TIME - $START_TIME ))
# сносим файлы старше 30 дней
#http://wiki.ayac.ru/komandy/udalenie-fa ... rse-n-dnej
find /home/bkp/ -atime +30 | xargs rm -f
echo "It took $DIFF seconds"
echo "backup done!"