Created
September 8, 2015 02:56
-
-
Save pisceanfoot/d641f839032e8ed39335 to your computer and use it in GitHub Desktop.
shell dir console color
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 | |
CURRENT_PATH=`dirname $0` | |
PORT="10002" | |
#LOG4JS_CONFIG="../config/logger.json" | |
PID_FILE="$CURRENT_PATH/../run/pid" | |
############################ | |
# FUNCTION | |
############################ | |
RES='\033[0m' | |
RED_COLOR='\033[47;31;1m' | |
GREEN_COLOR='\033[47;32;1m' | |
echo_success(){ | |
echo "${GREEN_COLOR}$1${RES}" | |
} | |
echo_failure(){ | |
echo "${RED_COLOR}$1${RES}" | |
} | |
############################ | |
# END FUNCTION | |
############################ | |
echo "###### Stat app #######" | |
if [ -n "$LOG4JS_CONFIG" ]; then | |
echo "Setting log config path: $CURRENT_PATH/$LOG4JS_CONFIG" | |
if [ -f $CURRENT_PATH/$LOG4JS_CONFIG ]; then | |
echo_success "Log config path: $CURRENT_PATH/$LOG4JS_CONFIG" | |
LOG4JS_CONFIG=$CURRENT_PATH/$LOG4JS_CONFIG | |
export LOG4JS_CONFIG | |
else | |
echo_failure "Log config file not found: $CURRENT_PATH/$LOG4JS_CONFIG" | |
fi | |
fi | |
if [ -n "$PORT" ]; then | |
echo_success "Listening on port: $PORT" | |
export PORT | |
fi | |
echo "$CURRENT_PATH/www" | |
nohup node "$CURRENT_PATH/www" > /dev/null 2>&1 & echo $! > $PID_FILE | |
echo "Running node on pid: $!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment