All pastes #586867 Raw Edit

Someone

public text v1 · immutable
#586867 ·published 2007-06-24 02:33 UTC
rendered paste body
#!/bin/sh

DIRECTORIES="/var/log /usr/local/apache2/logs /share/Quicken /home/lotec /var/www/htdocs"                                     # directories to backup
BACKUPTO=/backup/backup                       # where to store the backups
BACKUPLOG="/var/log/backup$(date '+%Y.%m.%d:%H:%M').log"   # where to store log file
TAR=/bin/tar                                  # name and locaction of tar

#remove old files

#find all files under /backup/backup older than 2 days, and delete
find $BACKUPTO -type f -mtime +2 | xargs rm -f

#find all files newer than FILE, and delete
find $BACKUPTO -type f -newer /backup -exec rm -f {} \;

# Backup

$TAR cfz $BACKUPTO/blackknight$(date '+%Y.%m.%d:%H:%M').tgz $DIRECTORIES &> $BACKUPLOG