-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tomcat.sh
More file actions
executable file
·54 lines (47 loc) · 1.21 KB
/
run_tomcat.sh
File metadata and controls
executable file
·54 lines (47 loc) · 1.21 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
#!/bin/bash
tomcatdir=/sibcb2/bioinformatics2/chenyulong/software/tomcat-10.0.0
idxdir=last_directory
function usage {
echo
echo "Usage:"
echo " bash $0 [options]"
echo "Description:"
echo " the script is used to start tomcat for a web site."
echo " -i/--idxdir path -- the absolute path of directory for index.html, [default: $idxdir]."
echo " -r/--run -- start tomcat."
echo " -s/--stop -- stop the running tomcat."
echo " -h/--help -- show help message."
echo
exit 0
}
if [ $# -ne 1 ];then
usage
fi
ARG=$(getopt -q -o hrsi: --long help,run,stop,idxdir: -n $0 -- $@)
eval set -- $ARG
while [ -n "$1" ];do
case "$1" in
-i|--ip)
idxdir=$2;shift 2;;
-r|--run)
run=true;shift 1;;
-s|--stop)
stop=true;shift 1;;
-h|--help)
help=true;shift 1;;
*)
break;;
esac
done
if [ $idxdir != 'last_directory' ];then
sed -i "s#docBase=\(\".*\"\) #docBase=\"$idxdir\" #g" $tomcatdir/conf/server.xml
fi
if [[ $run == 'true' ]];then
bash $tomcatdir/bin/startup.sh
echo -e "\ntomcat is runnig"
elif [[ $stop == 'true' ]];then
bash $tomcatdir/bin/shutdown.sh
echo -e "\ntomcat has been shut down"
else
usage
fi