-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitrine.sh
82 lines (69 loc) · 1.53 KB
/
vitrine.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
#
# vitrine Startup script for the sdn vitrine application#
#
# chkconfig: 2345 75 25
# description: vitrine
# processname: vitrine
# Source function library.
### BEGIN vars
APP=vitrine
APPNAME=vitrine
PORT=9000
BASE_DIR=/home/ottk/apps
PLAY_VERSION=
APPLICATION_PATH=${BASE_DIR}/${APP}
PROD_PATH="${APPLICATION_PATH}/target/universal/stage"
CONF_PATH="${PROD_PATH}/conf/ite20.conf"
USER=ottk
APPLICATION_SECRET=X?4WDTKsb3s:zCs0bVhFS]S@28U9:To1oOPIH6Vrxet5osACcGfX>vUyiLe4D
export APPLICATION_SECRET
# Specific project configuration environment :
export _JAVA_OPTIONS="-Xms1024m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m"
### END vars
# Exit immediately if a command exits with a nonzero exit status.
set -e
update() {
echo "Updating"
cd $APPLICATION_PATH || exit
unset GIT_DIR
# Update repo
git pull
cd $APPLICATION_PATH
# Creating new project (MUST BE ON THE GOOD DIR)
$APPLICATION_PATH/activator clean compile stage
}
start() {
echo "Starting server"
cd $APPLICATION_PATH
$PROD_PATH/bin/$APPNAME -Dhttp.port=$PORT -Dconfig.file=$CONF_PATH &
}
stop() {
echo "Stopping server"
if [ -f $PROD_PATH"/RUNNING_PID" ];then
kill `cat $PROD_PATH"/RUNNING_PID"`
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
update)
update
;;
force-restart)
stop
update
start
;;
*)
echo $"Usage: $0 {start|force-restart|stop|restart|update}"
esac
exit 0