-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployApplicationToJetty.sh
executable file
·57 lines (43 loc) · 1.03 KB
/
deployApplicationToJetty.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
# variables
BASE_DIR=`pwd`
WAR=$BASE_DIR/$1
JETTY=$2
echo "BASE directory: $BASE_DIR"
echo "WAR location: $WAR"
echo "JETTY location: $JETTY"
# validate the paths
if [ ! -f $WAR ]
then
echo "Web app could not be found..."
exit
fi
if [ ! -f $JETTY/bin/jetty.sh ]
then
echo "Jetty could not be found..."
exit
fi
# 1st we need to stop jetty
echo "Stopping Jetty..."
$JETTY/bin/jetty.sh stop
echo "Removing old webapp and logs"
# 2nd we need to clear out old code from jetty
rm -rf $JETTY/webapps/root
rm -rf $JETTY/logs/*
# 3rd we need to move our webapp over to Jetty's webapps directory
echo "Re-creating webapp directory"
# recreate root webapp
mkdir $JETTY/webapps/root
echo "Pushd into webapps directory"
# go into that directory
pushd $JETTY/webapps/root
echo "Extracting new code into webapp directory"
# extract war into directory
jar xf $WAR
# back to where we were
popd
echo "Starting Jetty..."
# restarting jetty
$JETTY/bin/jetty.sh start > /dev/null 2>&1
# default exit call and we can call it a day
exit 0