-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitch_mode.sh
More file actions
executable file
·52 lines (46 loc) · 1.43 KB
/
switch_mode.sh
File metadata and controls
executable file
·52 lines (46 loc) · 1.43 KB
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
#!/bin/bash
cd `dirname $0`
which mvn > /dev/null 2>&1
if [ $? -eq 0 ]; then
mvn --version
else
echo "Maven is not installed"
exit 0
fi
which mvn > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo 'Checking update ....'
git fetch
current_rev=`git rev-parse HEAD`
remote_rev=`git rev-parse origin/HEAD`
if [ ${current_rev} = ${remote_rev} ]; then
echo 'Your repository is the latest'
else
echo -e '\033[31m[WARNING]:Your repository is already out of date. Please git pull and update.\033[m'
fi
else
echo "Git is not installed"
exit 0
fi
readonly CLASS_FILE="./src/main/resources/javaep.properties_class"
readonly EXAM_FILE="./src/main/resources/javaep.properties_exam"
readonly SETTING_FILE="./src/main/resources/javaep.properties"
readonly SECURITY_FILE="./src/main/webapp/WEB-INF/spring/security.xml"
if diff -q $CLASS_FILE $SETTING_FILE >/dev/null ; then
echo "MODE SWITCH Exam mode"
cp $EXAM_FILE $SETTING_FILE
cp ${SECURITY_FILE}_exam $SECURITY_FILE
else
echo "MODE SWITCH Class mode"
cp $CLASS_FILE $SETTING_FILE
cp ${SECURITY_FILE}_class $SECURITY_FILE
fi
mvn package
readonly TOMCAT_BIN="/opt/tomcat/apache-tomcat-8.5.20/bin"
readonly WEBAPPS_DIR="/opt/tomcat/apache-tomcat-8.5.20/webapps"
export PATH="${TOMCAT_BIN}:$PATH"
sudo service httpd stop
sudo ${TOMCAT_BIN}/shutdown.sh
sudo cp ./target/javaep-1.0.0-BUILD-SNAPSHOT.war "${WEBAPPS_DIR}/JavaEP.war"
sudo ${TOMCAT_BIN}/startup.sh
sudo service httpd start