#!/bin/sh # Initialization: . /usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs usage() { cat < 1.0 Resource Agent for the OpenSer SIP Proxy. OpenSer resource agent IP Address of the OpenSer Instance. This is only used for monitoring. IP Address Port of the OpenSer Instance. This is only used for monitoring. Port END } OpenSer_Status() { #echo "/usr/bin/sipsak -s sip:test@$OCF_RESKEY_ip -H 127.0.0.1 2>/dev/null >/dev/null" > /tmp/a /usr/bin/sipsak -s sip:test@$OCF_RESKEY_ip -H 127.0.0.1 2>/dev/null >/dev/null rc=$? if [ $rc -ne 0 ] then return $OCF_NOT_RUNNING else return $OCF_SUCCESS fi } OpenSer_Monitor( ) { OpenSer_Status } OpenSer_Start( ) { if OpenSer_Status then ocf_log info "OpenSer already running." return $OCF_SUCCESS else /etc/init.d/openser start >/dev/null rc=$? if [ $rc -ne 0 ] then return $OCF_ERR_PERM else return $OCF_SUCCESS fi fi } OpenSer_Stop( ) { /etc/init.d/openser stop >/dev/null return $OCF_SUCCESS } OpenSer_Validate_All( ) { return $OCF_SUCCESS } if [ $# -ne 1 ]; then usage exit $OCF_ERR_ARGS fi case $1 in meta-data) meta_data exit $OCF_SUCCESS ;; start) OpenSer_Start ;; stop) OpenSer_Stop ;; monitor) OpenSer_Monitor ;; status) OpenSer_Status ;; validate-all) OpenSer_Validate_All ;; notify) exit $OCF_SUCCESS ;; promote) exit $OCF_SUCCESS ;; demote) exit $OCF_SUCCESS ;; usage) usage exit $OCF_SUCCESS ;; *) usage exit $OCF_ERR_ARGS ;; esac exit $?