Project

General

Profile

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
function start {
25
	if [ -z "$JAVA_HOME" ]; then
26
		echo "no JDK found - please set JAVA_HOME"
27
		exit 1
28
	fi
29

    
30
	if [ ! -d "$CATALINA_HOME/conf" ]; then
31
		echo "invalid CATALINA_HOME specified"
32
		exit 1
33
	fi
34

    
35
	log_daemon_msg "Starting $DESC" 
36
	$CATALINA_HOME/bin/startup.sh
37
	echo 0
38
}  
39

    
40
function stop {
41
	echo "Stopping $DESC"
42
	$CATALINA_HOME/bin/shutdown.sh
43
	echo 0
44
}
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
	echo "Usage: $0 {start|stop|restart}"
60
	exit 1
61
	;;
62
esac
63

    
64
exit 0
(8-8/9)