forked from mskcc/LimsRest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeployLatestRest.sh
More file actions
executable file
·34 lines (34 loc) · 942 Bytes
/
deployLatestRest.sh
File metadata and controls
executable file
·34 lines (34 loc) · 942 Bytes
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
#!/bin/bash
currentUser=$(whoami)
if [[ $currentUser != "sapio-tomcat" ]];then
echo "Must be run as sapio-tomcat"
exit 1
fi
tomcatLocation=/srv/www/sapio/tomcat7
currentDir=$(pwd)
unset -v newestLims
for file in LimsRest*.war; do
[[ $file -nt $newestLims ]] && newestLims=$file
done
cd $tomcatLocation
jar xvf $newestLims WEB-INF/classes/connect.txt
machine=$(hostname)
machineName=${machine/.*/}
machineMatch=$(grep $machineName WEB-INF/classes/connect.txt)
cd $currentDir
if [[ -z $machineMatch ]];then
echo "It appears $newestLims is not built for machine $machineName. Not deploying."
else
unset -v deployedLims
for file in $tomcatLocation/webapps/LimsRest*.war; do
deployedLims=$file
done
if [[ -f $deployedLims ]];then
echo "Undeploying $deployedLims"
mv $deployedLims $tomcatLocation
sleep 6
fi
echo "Deploying $newestLims"
cp $newestLims $tomcatLocation/webapps
fi
exit