1
|
#!/bin/bash
|
2
|
#
|
3
|
# /etc/init.d/tomcat5.5 -- startup script for the Tomcat 5 servlet engine customixed
|
4
|
# for Metacat
|
5
|
#
|
6
|
# Written by Michael Daigle <daigle@nceas.ucsb.edu>.
|
7
|
#
|
8
|
|
9
|
DESC="Tomcat servlet engine"
|
10
|
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
|
11
|
export CATALINA_HOME=/usr/share/tomcat5.5
|
12
|
|
13
|
if [ `id -u` -ne 0 ]; then
|
14
|
echo "You need root privileges to run this script"
|
15
|
exit 1
|
16
|
fi
|
17
|
|
18
|
# Make sure tomcat is started with system locale
|
19
|
if [ -r /etc/default/locale ]; then
|
20
|
. /etc/default/locale
|
21
|
export LANG
|
22
|
fi
|
23
|
|
24
|
. /lib/lsb/init-functions
|
25
|
. /etc/default/rcS
|
26
|
|
27
|
function start {
|
28
|
if [ -z "$JAVA_HOME" ]; then
|
29
|
log_failure_msg "no JDK found - please set JAVA_HOME"
|
30
|
exit 1
|
31
|
fi
|
32
|
|
33
|
if [ ! -d "$CATALINA_HOME/conf" ]; then
|
34
|
log_failure_msg "invalid CATALINA_HOME specified"
|
35
|
exit 1
|
36
|
fi
|
37
|
|
38
|
log_daemon_msg "Starting $DESC"
|
39
|
$CATALINA_HOME/bin/startup.sh
|
40
|
log_end_msg 0
|
41
|
}
|
42
|
|
43
|
function stop {
|
44
|
log_daemon_msg "Stopping $DESC"
|
45
|
$CATALINA_HOME/bin/shutdown.sh
|
46
|
log_end_msg 0
|
47
|
}
|
48
|
|
49
|
case "$1" in
|
50
|
start)
|
51
|
start
|
52
|
;;
|
53
|
stop)
|
54
|
stop
|
55
|
;;
|
56
|
restart|force-reload)
|
57
|
stop
|
58
|
sleep 5
|
59
|
start
|
60
|
;;
|
61
|
*)
|
62
|
log_success_msg "Usage: $0 {start|stop|restart}"
|
63
|
exit 1
|
64
|
;;
|
65
|
esac
|
66
|
|
67
|
exit 0
|