Skip to content

Instantly share code, notes, and snippets.

@theharveyz
Created August 17, 2017 09:24
Show Gist options
  • Save theharveyz/569956a9756cb7974a1255e70249fb07 to your computer and use it in GitHub Desktop.
Save theharveyz/569956a9756cb7974a1255e70249fb07 to your computer and use it in GitHub Desktop.
go build
#!/bin/bash
RUN_MODE=develop
APP_NAME=wawazu-machine-server
SVC_NAME=$APP_NAME-$RUN_MODE
PRJ_PATH=/data/projects/$RUN_MODE/$APP_NAME
BIN_NAME=$APP_NAME-$RUN_MODE
RUN_PATH=/data/GORUN/$RUN_MODE/$APP_NAME
BUILDNO=`date '+%Y%m%d%H%M%S'`
mkdir -p $RUN_PATH
export GOROOT=/data/GO1.4.1
export GOPATH=/data/projects/develop/gopath-develop
export GOPATH=$GOPATH:$PRJ_PATH
cd $PRJ_PATH
$GOROOT/bin/go build -ldflags "-X main.BuildNumber=$BUILDNO" -o $PRJ_PATH/bin/$BIN_NAME "src/$APP_NAME.go"
cd $PRJ_PATH/bin
/usr/bin/supervisorctl stop $SVC_NAME
cp * $RUN_PATH -Rf
cd $RUN_PATH
/usr/bin/supervisorctl start $SVC_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment