#!/bin/sh
# Backup script created by Mike from Mijn-Sleutel.net 2004
# Any questions mail to backup@mijn-sleutel.nl
#
#
# Description:
# This one moves the backup from the ftp dir to prevent deleting
# if someone get the login / pass. It also check how old the 
# backups are, if they are to old, then they got deleted.
#
# Define settings
DATE=`/bin/date +%m-%e-%y`
ftpdir= # NO TRAILING SLASH!!!
backupdirfiles=# NO TRAILING SLASH!!!
backupdir= # NO TRAILING SLASH!!!
prunetime= # SET DAYS HOW LONG BACKUP STAYS BEFORE GOT DELETED
logmail=

cd $backupdir
echo -e "\033[32;1m [1] \033[0m"Moving files from $ftpdir to $backupdirfiles
/bin/mv $ftpdir/* $backupdirfiles
echo -e "\033[32;1m [2] \033[0m"Add the latest backup file to the log...
find $backupdirfiles/* -mtime -1 -print >> $backupdir/backup_list
echo -e "\033[32;1m [3] \033[0m"Preparing email..
find $backupdirfiles/* -mtime -1 -print > $backupdir/backup_mail
ls --full-time $backupdirfiles/* >> $backupdir/backup_mail
echo -e "\033[32;1m [4] \033[0m"Removing backup files older than $prunetime days...
find $backupdirfiles/*  -mtime +$prunetime -exec rm {} \;
echo -e "\033[32;1m [5] \033[0m"Mailing log...
mutt -s "Remote van $DATE" $logmail< "." \ < backup_mail
echo -e "\033[32;1m It looks like it is finisched \033[0m"