]> arthur.barton.de Git - ocf-ra.git/blob - Apache2
OCFS2_DRBD: verify-all should be validate-all ...
[ocf-ra.git] / Apache2
1 #!/bin/sh
2 #
3 # OCF RA for Apache2
4 #
5 # Copyright (c) 2009 Barton IT-Consulting
6 # Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-BrĂ©e
7 #                    All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of version 2 of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 #
17 # Further, this software is distributed without any warranty that it is
18 # free of the rightful claim of any third person regarding infringement
19 # or the like.  Any license provided herein, whether implied or
20 # otherwise, applies only to this software file.  Patent licenses, if
21 # any, provided herein do not apply to combinations of this program with
22 # other software, or any other product whatsoever.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write the Free Software Foundation,
26 # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
27 #
28
29 # Initialization:
30 . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
31
32 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33
34 meta_data() {
35         cat <<END
36 <?xml version="1.0"?>
37 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
38 <resource-agent name="Apache2">
39 <version>1.1</version>
40
41 <longdesc lang="en">
42 This Resource Agent starts and stops the Apache2 web server.
43 </longdesc>
44 <shortdesc lang="en">Apache2 resource agent</shortdesc>
45
46 <actions>
47 <action name="start" timeout="30" />
48 <action name="stop" timeout="30" />
49 <action name="monitor" timeout="20" interval="30" depth="0" start-delay="10" />
50 <action name="meta-data" timeout="5" />
51 <action name="verify-all" timeout="30" />
52 </actions>
53 </resource-agent>
54 END
55 }
56
57 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
58
59 if [ -r `dirname "$OCF_RESKEY_configfile"`/envvars ]; then
60         # source Apache2 environment variables
61         . `dirname "$OCF_RESKEY_configfile"`/envvars
62 fi
63
64 Apache2_usage() {
65         echo "usage: $0 {start|stop|monitor|validate-all|meta-data}"
66 }
67
68 Apache2_start() {
69         apache2ctl configtest
70         if [ $? = $OCF_SUCCESS ]; then
71                 /usr/sbin/apache2ctl start
72                 if [ $? = $OCF_SUCCESS ]; then
73                         return $OCF_SUCCESS
74                 fi
75         fi
76         return $OCF_ERR_GENERIC
77 }
78
79 Apache2_stop() {
80         /usr/sbin/apache2ctl stop
81         if [ $? = $OCF_SUCCESS ]; then
82                 return $OCF_SUCCESS
83         fi
84         return $OCF_ERR_GENERIC
85 }
86
87 Apache2_monitor() {
88         /usr/sbin/apache2ctl status | grep "Server Version"
89         if [ $? = $OCF_SUCCESS ]; then
90                 return $OCF_SUCCESS
91         fi
92         return $OCF_NOT_RUNNING
93 }
94
95 Apache2_validate() {
96         return $OCF_SUCCESS
97 }
98
99 case $__OCF_ACTION in
100         meta-data)
101                 meta_data
102                 exit $OCF_SUCCESS
103                 ;;
104         start)
105                 Apache2_start
106                 ;;
107         stop)
108                 Apache2_stop
109                 ;;
110         monitor)
111                 Apache2_monitor
112                 ;;
113         validate-all)
114                 Apache2_validate
115                 ;;
116         usage|help)
117                 Apache2_usage
118                 exit $OCF_SUCCESS
119                 ;;
120         *)
121                 Apache2_usage
122                 exit $OCF_ERR_UNIMPLEMENTED
123                 ;;
124 esac
125
126 rc=$?
127 ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
128 exit $rc
129
130 # -eof-