my PDS backup script!
pds-backup.sh
1#!/bin/sh
2
3DESTINATION=/home/cybr/pds-backups
4SOURCE=/home/cybr/pds
5BACKUP=${DESTINATION}/pds_$(date +"%m-%d-%Y").tar.gz
6
7
8
9cd ${DESTINATION}
10ls -tr | head -n -5 | xargs rm
11
12if [ -e $BACKUP ];
13 then
14 echo "The backup for pds_${timestamp} has failed." | tee ${DESTINATION}/Error_$(date +"%m-%d-%Y")
15 else
16 tar -vczf ${BACKUP} ${SOURCE}
17fi