#!/bin/sh # # # Apache 1.3 OCF RA. Manages OpenBSD 1.3 httpd. # # Copyright (c) 2007 l00 bugdead prods, Sebastian Reitenbach # All Rights Reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it would be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Further, this software is distributed without any warranty that it is # free of the rightful claim of any third person regarding infringement # or the like. Any license provided herein, whether implied or # otherwise, applies only to this software file. Patent licenses, if # any, provided herein do not apply to combinations of this program with # other software, or any other product whatsoever. # # You should have received a copy of the GNU General Public License # along with this program; if not, write the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. # ####################################################################### # Initialization: . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs ####################################################################### meta_data() { cat < 1.0 This resource agent manages OpenBSD apache server or clients. OpenBSD apache Location of the apachectl binary. apachectl location. Location to store the PID file. PID file location. Parameters to apachectl, e.g. start or startssl. apachectl parameters. END } ####################################################################### # don't exit on TERM, to test that lrmd makes sure that we do exit trap sigterm_handler TERM sigterm_handler() { ocf_log info "They use TERM to bring us down. No such luck." return } apache13_usage() { cat < /dev/null 2>/dev/null if [ $? -eq 0 ];then return $OCF_SUCCESS else return $OCF_NOT_RUNNING fi } apache13_validate() { if [ ! -x ${OCF_RESKEY_apachectl} ];then return ${OCF_ERR_GENERIC} fi if [ ! -d `dirname ${OCF_RESKEY_pid}` ];then return ${OCF_ERR_GENERIC} fi return ${OCF_SUCCESS} } : ${OCF_RESKEY_apachectl=/usr/sbin/apachectl} : ${OCF_RESKEY_pid=/var/www/logs/httpd.pid} : ${OCF_RESKEY_parameters=start} case $__OCF_ACTION in meta-data) meta_data exit $OCF_SUCCESS ;; start) apache13_start;; stop) apache13_stop;; monitor) apache13_monitor;; migrate_to) ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to ${OCF_RESKEY_CRM_meta_migrate_to}." apache13_stop ;; migrate_from) ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to ${OCF_RESKEY_CRM_meta_migrated_from}." apache13_start ;; reload) ocf_log err "Reloading..." apache13_start ;; validate-all) apache13_validate;; usage|help) apache13_usage exit $OCF_SUCCESS ;; *) apache13_usage exit $OCF_ERR_UNIMPLEMENTED ;; esac rc=$? ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc" exit $rc