forked from krishna-waidande/Automating-deployment-process
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·46 lines (32 loc) · 1.02 KB
/
install.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
#!/bin/bash
WAR_NAME=`ls $1 | cut -d'.' -f1`
TOMCAT_PATH=`cat $1 | grep "tomcat.dir" | cut -d'=' -f2`
PLUGIN_DIR=`cat $1 | grep "plugin.dir" | cut -d'=' -f2`
BACKUP_DIR=$(date +%d%B%Y)
CURRENT_PATH=$(pwd)
echo "War name : $WAR_NAME";
echo "Creating folder with today's date";
mkdir bkp_$BACKUP_DIR
echo "creating backup folders for plugins and war";
mkdir bkp_$BACKUP_DIR/war bkp_$BACKUP_DIR/plugins
echo "Taking backup of plugin";
cp $PLUGIN_DIR/*.jar bkp_$BACKUP_DIR/plugins
echo "Taking war backup";
cd $TOMCAT_PATH
WAR_NAME=$WAR_NAME.war
cp webapps/$WAR_NAME $CURRENT_PATH/bkp_$BACKUP_DIR/war
echo "Server Down";
bin/./shutdown.sh -force
echo "Removing plugins";
rm $PLUGIN_DIR/*.jar
echo "Removing war"
rm webapps/$WAR_NAME
echo "adding .properties file into tomcat/conf";
cp $CURRENT_PATH/$1 conf/
echo "Adding new plugins";
cp $CURRENT_PATH/plugin_build/*.jar $PLUGIN_DIR
echo "Adding new war";
cp $CURRENT_PATH/openspecimen.war webapps/
mv webapps/openspecimen.war webapps/$WAR_NAME
echo "Server Up..";
bin/./startup.sh