function.sh
1.19 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
################################################################
#@Authro Lijian
#@Date 2007-08-09
################################################################
PROJECT_TARGET=$2.zip
WEB_APP_HOME=$1/$2/deploy
EXE_COMMOND=$3
stopapp(){
if [ -d $WEB_APP_HOME ]; then
sh $WEB_APP_HOME/bin/killws.sh
fi
}
#app install
install(){
if [ -d $WEB_APP_HOME ]; then
sh $WEB_APP_HOME/bin/killws.sh
echo "[INFO] rm -rf $WEB_APP_HOME"
rm -rf $WEB_APP_HOME
fi
echo "[INFO] mkdir $WEB_APP_HOME"
mkdir $WEB_APP_HOME
echo "[INFO] unzip -q $WEB_APP_HOME/../$PROJECT_TARGET -d $WEB_APP_HOME"
unzip -q $WEB_APP_HOME/../$PROJECT_TARGET -d $WEB_APP_HOME
}
#app startup
startup(){
sh $WEB_APP_HOME/bin/startws.sh
}
#app links
links(){
echo "[INFO] ln -s ..."
if [ -d $WEB_APP_HOME/htdocs ]; then
ln -s /data/upload $WEB_APP_HOME/htdocs/upload
fi
#if [ -d $WEB_APP_HOME/htdocs ]; then
#ln -s $WEB_APP_HOME/logs $WEB_APP_HOME/htdocs/logs
#fi
}
main(){
if [ $EXE_COMMOND = "Deploy" ]; then
install
startup
links
elif [ $EXE_COMMOND = "Restart" ]; then
stopapp
startup
elif [ $EXE_COMMOND = "Stop" ]; then
stopapp
else
echo "EXE_COMMOND error!"
fi
}
main