Created
August 14, 2014 00:20
-
-
Save tsohr/2b47c28e46647a63643e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| DIR="$( cd "$( dirname "$0" )" && pwd )" | |
| pushd "$DIR" > /dev/null | |
| tar -z -p -c -f `date +"%Y%m%d-%H%M%S"`.www.gz -C / -P /etc/httpd/ /srv/www/ | |
| BACKUP_CNT=`ls *.www.gz | wc -l` | |
| if [ "$BACKUP_CNT" -gt "15" ]; then | |
| LAST_BACKUP=`ls *.www.gz | sort | head -n 1` | |
| rm -f $LAST_BACKUP | |
| fi | |
| popd > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment