Skip to content

Instantly share code, notes, and snippets.

@dkrnl
Last active August 16, 2016 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkrnl/0016c9c49853a0f1c3058be266d16487 to your computer and use it in GitHub Desktop.
Save dkrnl/0016c9c49853a0f1c3058be266d16487 to your computer and use it in GitHub Desktop.
Backup sites in www directory
#!/usr/bin/env bash
cd /var/backups/www
# backup www folders
for i in `find /www/* -type d -nowarn -maxdepth 0 -exec basename {} \;`;
do
tar -cvzf $i.$(date +%F).tgz /www/$i
done
# remove older backups
find /var/backups/www -type f -name '*.tgz' -mtime +15 -delete
# todo rsync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment