-
Notifications
You must be signed in to change notification settings - Fork 0
/
tomcat
executable file
·69 lines (58 loc) · 1.16 KB
/
tomcat
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/sh
#
# chkconfig: - 86 14
# description: control all tomcat instances
#
# $Id: tomcat 3600 2011-10-06 00:37:34Z mheiges $
# $URL: https://mango.ctegd.uga.edu/svn/ApiCommonSystem/trunk/Tomcat/bin/tomcat $
#
TOMCAT_INSTANCES_DIR=/usr/local/tomcat_instances
MANAGER=/usr/bin/instance_manager
cd $TOMCAT_INSTANCES_DIR
this=`basename $0`
if [ ! -x ${MANAGER} ]; then
echo "'${MANAGER}' not found or permissions not valid"
exit 1
fi
instances=`${MANAGER} list`
if [[ $? -ne 0 ]]; then
echo "Failed to run '${MANAGER} list'. Unable to continue."
exit 1
fi
start() {
if test `id -u` != 0; then
echo 'root permissions required'; exit 4;
fi
for instance in ${instances[@]}; do
${MANAGER} start $instance
done
}
stop() {
if test `id -u` != 0; then
echo 'root permissions required'; exit 4;
fi
for instance in ${instances[@]}; do
${MANAGER} stop $instance
done
}
case "$1" in
start)
start
exit $?
;;
stop)
stop
exit $?
;;
restart)
stop
start
exit $?
;;
status)
${MANAGER} status
;;
*)
echo "usage: $this {start|stop|restart|status}"
;;
esac