-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_tomcat.sh
More file actions
executable file
·35 lines (33 loc) · 915 Bytes
/
run_tomcat.sh
File metadata and controls
executable file
·35 lines (33 loc) · 915 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
35
#!/bin/bash
usage="Usage:\n\tbash $0 -r/-s [idxdir]\n
\noptions:\n\t -r\trun tomcat
\n \t -s\tstop tomcat
\n \t idxdir\tthe absolute path of directory for index.html"
tomcatdir=/home/chenyl/tomcat
if [ $# -eq 2 ];then
sed -i "s#docBase=\(\".*\"\) #docBase=\"$2\" #g" $tomcatdir/conf/server.xml
if [[ $1 == '-r' ]];then
bash $tomcatdir/bin/startup.sh
echo -e "\ntomcat is runnig"
elif [[ $1 == '-s' ]];then
bash $tomcatdir/bin/shutdown.sh
echo -e "\ntomcat has been shut down"
else
echo -e $usage
exit 1
fi
elif [ $# -eq 1 ];then
if [[ $1 == '-r' ]];then
bash $tomcatdir/bin/startup.sh
echo -e "\ntomcat is runnig"
elif [[ $1 == '-s' ]];then
bash $tomcatdir/bin/shutdown.sh
echo -e "\ntomcat has been shut down"
else
echo -e $usage
exit 1
fi
else
echo -e $usage
exit 1
fi