-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·36 lines (28 loc) · 758 Bytes
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
LOG_DIR=logs
PROJECT=kursstatistik-api
if [ "$1" = "ref" ] ; then
LOG_DIR=/var/log/$PROJECT
fi
if [ "$1" = "prod" ] ; then
LOG_DIR=/var/log/$PROJECT
fi
SYSTEM_LOG_FILE=$PROJECT.log
SYSTEM_LOG="$LOG_DIR/$SYSTEM_LOG_FILE"
PIDFILE=$LOG_DIR/RUNNING_PID
export NODE_PATH=`pwd`
# Check parameter for type of env
if [ "$1" = "prod" ] ; then
NODE_ENV=production node app.js > $SYSTEM_LOG 2>&1 &
echo $! > $PIDFILE
elif [ "$1" = "ref" ] ; then
NODE_ENV=referens node app.js > $SYSTEM_LOG 2>&1 &
echo $! > $PIDFILE
else
SERVICE=mongod
MONGO_LOG_FILE=mongod.log
MONGO_LOG="$LOG_DIR/$MONGO_LOG_FILE"
echo "Starting MongoDB. Logging to $MONGO_LOG"
$SERVICE --fork --logpath $MONGO_LOG
npm run installAndStart
fi