Project

General

Profile

1 4656 daigle
#!/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
function start {
25
	if [ -z "$JAVA_HOME" ]; then
26 4819 daigle
		echo "no JDK found - please set JAVA_HOME"
27 4656 daigle
		exit 1
28
	fi
29
30
	if [ ! -d "$CATALINA_HOME/conf" ]; then
31 4819 daigle
		echo "invalid CATALINA_HOME specified"
32 4656 daigle
		exit 1
33
	fi
34
35
	log_daemon_msg "Starting $DESC"
36
	$CATALINA_HOME/bin/startup.sh
37 4819 daigle
	echo 0
38 4656 daigle
}
39
40
function stop {
41 4819 daigle
	echo "Stopping $DESC"
42 4656 daigle
	$CATALINA_HOME/bin/shutdown.sh
43 4819 daigle
	echo 0
44 4656 daigle
}
45
46
case "$1" in
47
  start)
48
	start
49
	;;
50
  stop)
51
	stop
52
	;;
53
  restart|force-reload)
54
	stop
55
	sleep 5
56
	start
57
	;;
58
  *)
59 4819 daigle
	echo "Usage: $0 {start|stop|restart}"
60 4656 daigle
	exit 1
61
	;;
62
esac
63
64
exit 0