-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·41 lines (30 loc) · 1.01 KB
/
deploy.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
#!/bin/bash
instances="p0 p1"
locals="at ch da de es fi fr it nl no pl se"
basepath="/data/deploy"
applicationpath="/data/app/"
hostname=`/bin/hostname -s | /usr/bin/awk -F- '{print $NF}'`
scriptname=`/usr/bin/basename ${0}`
if [ -f /tmp/${scriptname}.lock ]; then
pid=`cat /tmp/${scriptname}.lock`
if [ `ps $pid` >/dev/null 2>&1 -ne 0 ]; then
exit
fi
fi
echo $$ > /tmp/${scriptname}.lock
for local in $locals; do
for instance in $instances; do
for file in ${basepath}/${local}/${hostname}/${instance}/*; do
if [ ! -f ${file} ]; then
continue;
fi
context=`basename $file | awk -F.war '{print $1}'`
echo `date +%Y-%m-%d\ %H:%M:%S` ${instance}::${context}
rm -rf ${applicationpath}/${instance}/webapps/${context}/
mv -v ${file} ${applicationpath}/${instance}/webapps/
/etc/init.d/tomcat5.5-${instance} restart
done
rm -f ${file}
done
done
rm -f /tmp/${scriptname}.lock