forked from edbirmingham/network
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstartup
More file actions
executable file
·38 lines (33 loc) · 830 Bytes
/
startup
File metadata and controls
executable file
·38 lines (33 loc) · 830 Bytes
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
37
38
#!/bin/bash
MONPATH="/home/ubuntu/workspace/mongo"
LOGFILE="$MONPATH/mongod.log"
ISNEW="0"
DOMAIN="http://localhost:8080/status"
echo "Checking for mongo installation."
if [ ! -d $MONPATH ];
then
echo "Creating new mongo directory."
ISNEW=1
mkdir $MONPATH
fi
echo "Checking to see if mongo is running."
MONGORUN="$(pidof mongod | wc -l)"
if [ $MONGORUN = "0" ]; then
echo "Staring mongo."
mongod --dbpath $MONPATH --smallfiles --fork --logpath $LOGFILE
else
echo "Mongo already running."
fi
if [ "$ISNEW" = "1" ]; then
echo "Initializing new mongo database."
grunt initdb
fi
echo "Checking for existing instance of Network."
GRUNTRUN="$(curl $DOMAIN 2> /dev/null)"
if [ "$GRUNTRUN" = "OK" ]; then
echo "The Network is already running."
else
echo "Starting Network."
grunt
fi
exit 0