Created
December 2, 2013 07:04
-
-
Save rch850/7746093 to your computer and use it in GitHub Desktop.
git push で node アプリ走らせる時のとりあえずスクリプト。なんかいいのあったら教えて
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 -eu | |
git update-server-info | |
APP_HOME=/home/rch850/hogeapp | |
APP_BRANCH=develop | |
PIDFILE=$APP_HOME/node.pid | |
export GIT_DIR=$APP_HOME/.git | |
(cd $APP_HOME && git --git-dir=.git pull && git checkout $APP_BRANCH) | |
if [ -f $PIDFILE ]; then | |
PID=$(cat $PIDFILE) | |
rm $PIDFILE && kill $PID | |
fi | |
cd $APP_HOME && npm install | |
grunt stylus | |
nohup node app.js >& $APP_HOME.log & | |
echo $! > $PIDFILE | |
## 起動コマンドを npm start にすると、kill が node を止めてくれない | |
## grunt でもうまくいかない |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment