Created
December 3, 2014 22:53
-
-
Save pdonadeo/198af54c30e89f5dc602 to your computer and use it in GitHub Desktop.
Directory snapshot
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 | |
BACKUP_TS=`date +"%FT%H.%M.%S"` | |
DIR=`basename "$@"` | |
TAR_FILE=${DIR}_${BACKUP_TS}.tar.bz2 | |
SHA=${TAR_FILE}.sha1 | |
tar --acls --selinux --xattrs --force-local \ | |
--use-compress-program=/usr/bin/pbzip2 -cpf "${TAR_FILE}" "${DIR}" | |
chown root:root "${TAR_FILE}" | |
chmod 600 "${TAR_FILE}" | |
sha1sum "${TAR_FILE}" > "${SHA}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment