All pastes #381934 Raw Edit

Someone

public text v1 · immutable
·published 2007-03-05 04:18 UTC
rendered paste body
#!/bin/sh

DIRECTORIES="/var/log/messages /usr/local/apache2/logs /var/www/htdocs"        # directories to backup
BACKUPTO=/backup                       # where to store the backups
TAR=/bin/tar                            # name and locaction of tar

set $(date)
#remove old files
#find all files under /dir older than 7 days, and delete
find /backup -type f -mtime +2 | xargs rm -f
#find all files newer than FILE, and delete
find /backup -type f -newer /backup -exec rm \{\} \;

# Backup

BACKUPLOG="/var/log/backup$(date '+%Y.%m.%d:%H:%M').log"
export BACKUPLOG

tar cfz "/backup/blackknight$(date '+%Y.%m.%d:%H:%M').tgz" $DIRECTORIES