]> git.pld-linux.org Git - packages/tomcat.git/blob - apache-tomcat.init
- cleaning
[packages/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 ]; then
24                 # nls "ERROR: Networking is down. %s can't be run." <service>
25                 msg_network_down tomcat
26                 exit 1
27         fi
28 else
29         exit 0
30 fi
31
32 # See how we were called.
33 case "$1" in
34   start)
35         # Check if the service is already running?
36         if [ ! -f /var/lock/subsys/tomcat ]; then
37                 # show "Starting %s service" tomcat
38                 msg_starting tomcat
39                 busy
40                 su - http -s /bin/sh -c /usr/lib/tomcat/bin/startup.sh >/dev/null 2>&1
41                 RETVAL=$?
42                 if [ $RETVAL -eq 0 ]; then
43                         ok
44                 else
45                         fail
46                 fi
47                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/tomcat
48         else
49                 # show "%s service is already running." tomcat
50                 msg_already_running tomcat
51                 exit 1
52         fi
53         ;;
54   stop)
55         # Stop daemons.
56         # show "Stopping %s service" tomcat
57         if [ -f /var/lock/subsys/tomcat ]; then
58                 msg_stopping tomcat
59                 busy
60                 su - http -s /bin/sh -c /usr/lib/tomcat/bin/shutdown.sh >/dev/null 2>&1
61                 RETVAL=$?
62                 if [ $RETVAL -eq 0 ]; then
63                         ok
64                 else
65                         fail
66                 fi
67                 rm -f /var/lock/subsys/tomcat
68         else
69                 # show "%s service is not running." tomcat
70                 msg_not_running tomcat
71                 exit 1
72         fi      
73         ;;
74   restart|reload|force-reload)
75         $0 stop
76         $0 start
77         ;;
78   status)
79         echo "Not supported (yet?)"
80         RETVAL=0
81         ;;
82   *)
83         # show "Usage: %s {start|stop|restart|reload|force-reload|status}"
84         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
85         exit 1
86 esac
87
88 exit $RETVAL
89
90 # This must be last line !
91 # vi:syntax=sh:tw=78:ts=8:sw=4
This page took 0.039687 seconds and 4 git commands to generate.