-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcontrol.sh
executable file
·44 lines (42 loc) · 1.52 KB
/
control.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
#!/bin/bash
# Cycle modelr-server with a rebuild of the project
#Check to see if at least one argument was specified
if [ $# -lt 1 ] ; then
echo "You must specify at least 1 argument."
exit 1
fi
#Process the arguments
while [ $# -gt 0 ]
do
case "$1" in
stop ) ps aux | grep "modelr-server -p " | grep -v "grep" | awk '{print $2}' | xargs kill -9
echo Killed server
break
;;
clean ) python setup.py clean --all > modelr-server.log 2>&1
echo Cleaned build
break
;;
start ) python setup.py clean --all > modelr-server.log 2>&1
echo Cleaned build
python setup.py install >> modelr-server.log 2>&1
echo Compiled latest version
nohup modelr-server -p 8081 >> modelr-server.log 2>&1 &
echo Started server
break
;;
cycle ) ps aux | grep "modelr-server -p " | grep -v "grep" | awk '{print $2}' | xargs kill -9
echo Killed server
python setup.py clean --all > modelr-server.log 2>&1
echo Cleaned build
python setup.py install >> modelr-server.log 2>&1
echo Compiled latest version
nohup modelr-server -p 8081 >> modelr-server.log 2>&1 &
echo Re-started server
break
;;
* ) echo "`basename ${0}`:usage: ./control.sh [start] | [stop] | [cycle] | [help]"
exit 1 # Command to come out of the program with status 1
;;
esac
done