All pastes #586840 Raw Edit

Miscellany

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

DIRECTORIES="/var/log"                                     # directories to backup
BACKUPTO=/backup/backup                       # where to store the backups
TAR=/bin/tar                                  # name and locaction of tar

set $(date)

#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

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

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