]> git.pld-linux.org Git - packages/apache-tomcat.git/blob - apache-tomcat.init
- use functions
[packages/apache-tomcat.git] / apache-tomcat.init
1 #!/bin/sh
2 #
3 # tomcat        Jakarta Tomcat Servlet/JSP container
4 #
5 # chkconfig:    345  84 16
6 #
7 # description:  Jakarta Tomcat Servlet/JSP container
8 #
9 # $Id$
10
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 # Get network config
16 . /etc/sysconfig/network
17
18 # Get service config - may override defaults
19 [ -f /etc/sysconfig/tomcat ] && . /etc/sysconfig/tomcat
20
21 # Check that networking is up.
22 if is_yes "${NETWORKING}"; then
23         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
24                 msg_network_down tomcat
25                 exit 1
26         fi
27 else
28         exit 0
29 fi
30
31 start() {
32         # Check if the service is already running?
33         if [ ! -f /var/lock/subsys/tomcat ]; then
34                 msg_starting tomcat
35                 busy
36                 su - http -s /bin/sh -c /usr/share/tomcat/bin/startup.sh >/dev/null 2>&1
37                 [ $? -ne 0 ] && RETVAL=1
38                 if [ $RETVAL -eq 0 ]; then
39                         ok
40                         touch /var/lock/subsys/tomcat
41                 else
42                         fail
43                 fi
44         else
45                 msg_already_running tomcat
46         fi
47 }
48
49 stop() {
50         if [ -f /var/lock/subsys/tomcat ]; then
51                 # Stop daemons.
52                 msg_stopping tomcat
53                 busy
54                 su - http -s /bin/sh -c /usr/share/tomcat/bin/shutdown.sh >/dev/null 2>&1
55                 [ $? -eq 0 ] && ok || fail
56                 rm -f /var/lock/subsys/tomcat
57         else
58                 msg_not_running tomcat
59         fi
60 }
61
62 RETVAL=0
63 # See how we were called.
64 case "$1" in
65   start)
66         start
67         ;;
68   stop)
69         stop
70         ;;
71   restart|force-reload)
72         stop
73         start
74         ;;
75   status)
76         echo "Not supported (yet?)"
77         RETVAL=0
78         ;;
79   *)
80         msg_usage "$0 {start|stop|restart|force-reload|status}"
81         exit 3
82 esac
83
84 exit $RETVAL
This page took 0.465308 seconds and 4 git commands to generate.