Created
January 20, 2016 16:04
-
-
Save liaol/60b4d6fbebc334220441 to your computer and use it in GitHub Desktop.
beego project deploy script
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 | |
function log() { | |
echo -e "\033[32m $1 \033[0m" | |
} | |
log "starting deploy" | |
appname="appname" | |
path="/deploy/project" | |
src_path=$path"/src" | |
version=`date +%Y%m%d%H%M%S` | |
log "pull code" | |
cd $src_path | |
git reset HEAD --hard | |
git pull origin master | |
cd $path | |
log "starting build" | |
bee pack -p src -o build -ba "-o ${appname}" | |
log "decomporess" | |
tar -C app/ -xzf build/src.tar.gz | |
mv build/src.tar.gz build/$version.tar.gz | |
log "replace conf" | |
/bin/cp -rf conf/* app/conf/ | |
log "rsync" | |
#改成对应的 | |
rsync -avur app/ user@ip:/path -e 'ssh -p port -i id_rsa_file' --delete --compress --no-perms --no-owner --no-group | |
log "clean" | |
rm -rf app/* | |
log "all done" |
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 | |
binary_file=/path/to/binary_file | |
#存md5值的文件 | |
md5_file=/path/md5 | |
old_md5=`cat $md5_file` | |
new_md5=`md5sum "${binary_file}" | awk '{print $1}'` | |
if [ $old_md5 != $new_md5 ] | |
then | |
echo $new_md5 > $md5_file | |
/usr/bin/supervisorctl restart yourapp | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment