Last active
August 29, 2015 14:09
-
-
Save timtomch/f2339509c130e5663349 to your computer and use it in GitHub Desktop.
Backup home directory on web server (cron task)
This file contains 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 | |
tar czf path/to/backup/dir/webbackup_`date +%Y_%m_%d`.tgz -X backup-exclude.txt -C path/to/public_html public_html/ |
The path to public_html in the -C option must not contain public_html itself, obviously. This can be omitted, in which case the tar will contain the entire path to public_html. With the -C option, tar first changes to the directory just below public_html, then is executed on public_html.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
backup-exclude.txt contains a list of files/directories/patterns to be excluded, one by line: