-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/static/deps/* linguist-vendored | ||
*.tpl linguist-vendored | ||
/vendor/* linguist-vendored | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
language: go | ||
branches: | ||
only: | ||
- master | ||
go: | ||
- tip | ||
script: | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/bin/bash | ||
|
||
WORKSPACE=$(cd $(dirname $0)/; pwd) | ||
cd $WORKSPACE | ||
|
||
mkdir -p var | ||
|
||
app=blog | ||
pidfile=var/app.pid | ||
logfile=var/app.log | ||
|
||
function check_pid() { | ||
if [ -f $pidfile ];then | ||
pid=`cat $pidfile` | ||
if [ -n $pid ]; then | ||
running=`ps -p $pid|grep -v "PID TTY" |wc -l` | ||
return $running | ||
fi | ||
fi | ||
return 0 | ||
} | ||
|
||
function build() { | ||
CGO_ENABLED=0 GOOS=linux go build -v -a -installsuffix cgo -o $app . | ||
rm -rf release | ||
mkdir release | ||
cp blog release/ | ||
cp -r static release/ | ||
cp -r conf release/ | ||
cp -r custom release/ | ||
cp -r etc release/ | ||
} | ||
|
||
function start() { | ||
check_pid | ||
running=$? | ||
if [ $running -gt 0 ];then | ||
echo -n "$app now is running already, pid=" | ||
cat $pidfile | ||
return 1 | ||
fi | ||
|
||
|
||
nohup ./$app &>> $logfile & | ||
echo $! > $pidfile | ||
echo "$app started..., pid=$!" | ||
} | ||
|
||
function stop() { | ||
pid=`cat $pidfile` | ||
kill $pid | ||
echo "$app stoped..." | ||
} | ||
|
||
function restart() { | ||
stop | ||
sleep 1 | ||
start | ||
} | ||
|
||
function status() { | ||
check_pid | ||
running=$? | ||
if [ $running -gt 0 ];then | ||
echo started | ||
else | ||
echo stoped | ||
fi | ||
} | ||
|
||
function tailf() { | ||
tail -f $logfile | ||
} | ||
|
||
function pack() { | ||
build | ||
git log -1 --pretty=%h > gitversion | ||
version=`./$app -v` | ||
file_list="public control cfg.example.json $app" | ||
echo "...tar $app-$version.tar.gz <= $file_list" | ||
tar zcf $app-$version.tar.gz gitversion $file_list | ||
} | ||
|
||
function help() { | ||
echo "$0 build|start|stop|restart|status|tail" | ||
} | ||
|
||
if [ "$1" == "" ]; then | ||
help | ||
elif [ "$1" == "build" ];then | ||
build | ||
elif [ "$1" == "stop" ];then | ||
stop | ||
elif [ "$1" == "start" ];then | ||
start | ||
elif [ "$1" == "restart" ];then | ||
restart | ||
elif [ "$1" == "status" ];then | ||
status | ||
elif [ "$1" == "tail" ];then | ||
tailf | ||
else | ||
help | ||
fi |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.