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