Created
April 12, 2014 04:01
-
-
Save nakosung/10518184 to your computer and use it in GitHub Desktop.
git post-receive to automate deployment
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/sh | |
mkdir -p /home/ec2-user/var | |
PID=$(cat /home/ec2-user/var/gitrepo.pid) | |
kill -9 $PID | |
git --work-tree=/home/ec2-user/git-repo checkout -f | |
cd /home/ec2-user/git-repo | |
[ -s "/home/ec2-user/.nvm/nvm.sh" ] && . "/home/ec2-user/.nvm/nvm.sh" # This loads nvm | |
nvm use 0.10.26 | |
nohup coffee app.coffee > /home/ec2-user/var/gitrepo.log 2>&1 & | |
echo $! > /home/ec2-user/var/gitrepo.pid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment