Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- ## store the arguments given to the script
- read oldrev newrev refname
- ## Where to store the log information about the updates
- LOGFILE=./post-receive.log
- # The deployed directory (the running site)
- DEPLOYDIR=/directory/to/deploy/to
- GITDIR=/directory/above/hooks/repo_name.git
- ## Record the fact that the push has been received
- echo -e "Received Push Request at $( date +%Y-%m-%d:%H:%M:%S )" >> $LOGFILE
- echo " - Old SHA: $oldrev New SHA: $newrev Branch Name: $refname" >> $LOGFILE
- ## Update the deployed copy
- echo "Starting Deploy" >> $LOGFILE
- echo " - Starting code deployment (to $DEPLOYDIR)"
- # GIT_WORK_TREE="$DEPLOYDIR" git checkout -f
- cd "$DEPLOYDIR";
- git --git-dir="$GITDIR" --work-tree="$DEPLOYDIR" checkout -f;
- git --git-dir="$GITDIR" --work-tree="$DEPLOYDIR" submodule update --init --recursive
- cd -
- echo " - Finished code deployment"
- echo "Finished Deploy
- " >> $LOGFILE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement