Created
December 24, 2016 06:00
-
-
Save uuklanger/ecfb510d4895fda1d96e0ff4e7119297 to your computer and use it in GitHub Desktop.
Assuming you have a repository
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 | |
# (c)2016 KenWare | |
# | |
PROJECTS_FILE=$HOME/projects.list | |
REPO_DIR=/opt/data/git/repositories | |
BACKUP_LOCATION=/opt/backups/git_backups | |
CURRENT_DATE=`date +"%Y%m%d%H%M%S"` | |
for repo in `cat ${PROJECTS_FILE}` ; do | |
TARGET_ZIP=${CURRENT_DATE}"_"`echo ${repo}| sed "s/[\/\.]/_/g"`".tar.gz" | |
echo "REPOSITORY: "${REPO_DIR}/${repo} | |
echo "TARGET....: "${BACKUP_LOCATION}/${TARGET_ZIP} | |
tar zcfv ${BACKUP_LOCATION}/${TARGET_ZIP} ${REPO_DIR}/${repo} | |
echo "=====================================================================" | |
done | |
echo "Backing up GIT Home...." | |
tar zcfv ${BACKUP_LOCATION}/${CURRENT_DATE}"_home_git.tar.gz" /home/git | |
echo "DONE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment