-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc9.sh
62 lines (59 loc) · 1.08 KB
/
c9.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
58
59
60
61
62
#!/bin/bash
get_c9_pid(){
echo $(ps x | grep '[n]ode server.js' | awk '{print $1}')
}
start() {
local c9_pid=$(get_c9_pid)
if [ -z "$c9_pid" ];
then
if [ $? -eq 0 ];
then
nohup node server.js --listen 138.68.95.144 -p 8080 -a admin:1q2w3e4r5t6y7u8i9o@# -w /home/rovshan/development/djangoprojects/ >/dev/null 2>&1 &
echo "c9 started"
fi
else
echo "already running"
fi
}
stop() {
local c9_pid=$(get_c9_pid)
if [ ! -z "$c9_pid" ];
then
kill $c9_pid
if [ $? -eq 0 ];
then
echo "killed"
else
echo "cannot kill"
fi
else
echo "Nothing to stop"
fi
}
status() {
local c9_pid=$(get_c9_pid)
if [ -z "$c9_pid" ];
then
echo "process is not running"
else
echo "process is running"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
esac
exit 0