-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·58 lines (48 loc) · 1.47 KB
/
run.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! /bin/bash
WATCH_DIRS='public,.'
WATCH_TYPES='hbs|json|js|css|jade'
cleanupEnvironment() {
echo "---------------------------------------------------------------------"
echo "Killing all node processes (sry if you had others :/ )"
killall node
# after a keystroke
# echo "Stopping nginx"
# sudo nginx -s stop
echo "Everything Stopped. G2G!"
exit
}
# echo "Starting up nginx"
# sudo nginx -c $PWD/config/local/nginx.conf
case $1 in
-debug)
which supervisor
if [ "$?" -ne "0" ]; then
echo "FAIL Do --- npm install -g supervisor --- and try again"
else
echo "Starting supervisor in debug mode "
supervisor -p 1000 -n error -e $WATCH_TYPES -w $WATCH_DIRS -- --debug ./server.js &
node-inspector --web-port=5005 &
fi
;;
-debug-brk)
which supervisor
if [ "$?" -ne "0" ]; then
echo "FAIL Do --- npm install -g supervisor --- and try again"
else
echo "Starting supervisor in debug mode waiting for a debugger to connect"
supervisor -p 1000 -n error -e $WATCH_TYPES -w $WATCH_DIRS -- --debug-brk ./server.js &
node-inspector --web-port=5005 &
fi
;;
*)
echo "Starting supervisor"
supervisor -p 1000 -n error -e $WATCH_TYPES -w $WATCH_DIRS ./server.js &
;;
esac
echo "Monitoring Node Changes. Output is below"
echo ""
echo "Everything loaded. Press any key (or CTRL-C) to turn it all off: "
echo ""
trap cleanupEnvironment INT
read -p "---------------------------------------------------------------------"
cleanupEnvironment