aboutsummaryrefslogtreecommitdiff
path: root/sysutils/heartbeat/files/patch-heartbeat-resource.d-BSDService.in
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/heartbeat/files/patch-heartbeat-resource.d-BSDService.in')
-rw-r--r--sysutils/heartbeat/files/patch-heartbeat-resource.d-BSDService.in95
1 files changed, 95 insertions, 0 deletions
diff --git a/sysutils/heartbeat/files/patch-heartbeat-resource.d-BSDService.in b/sysutils/heartbeat/files/patch-heartbeat-resource.d-BSDService.in
new file mode 100644
index 000000000000..84c2b5b29652
--- /dev/null
+++ b/sysutils/heartbeat/files/patch-heartbeat-resource.d-BSDService.in
@@ -0,0 +1,95 @@
+--- heartbeat/resource.d/BSDService.in.orig 2009-01-16 21:21:34.000000000 +0100
++++ heartbeat/resource.d/BSDService.in 2009-01-16 21:21:11.000000000 +0100
+@@ -0,0 +1,92 @@
++#!/bin/sh
++#
++# Created by Piotr Rybicki (meritus@innervision.pl) for BSD community
++#
++# This script can be used do start/stop FreeBSD's
++# /usr/local/etc/rc.d/* services.
++#
++# One MUST NOT enable service (in /etc/rc.conf
++# there cannot be SERVICE_enable"YES" line)
++# Although other params for service are welcomed
++#
++# Service is started by 'onestart' parameter internally
++#
++# usage: $0 {start|stop|status}
++#
++# An example usage in /usr/local/etc/ha.d/haresources:
++# node1 10.0.0.170 BSDService::mysql-server
++#
++usage() {
++ cat <<-!
++usage: $0 SERVICE {start|stop|status}";
++!
++ exit 1
++}
++
++. /usr/local/etc/ha.d/shellfuncs
++RCD=/usr/local/etc/rc.d
++#VARLIB=/var/lib/heartbeat
++#VLFILE=$VARLIB/rsctmp/Delay
++
++BSDService_Status() {
++ if [ ! -f $RCD/$1 ]
++ then
++ echo "There is no $RCD/$1 script!. Fatal"
++ fi
++
++ $RCD/$1 onestatus 2>&1 1>/dev/null
++
++ if [ $? -eq 0 ]
++ then
++ if [ $2 = 'verbose' ]
++ then
++ echo "Service $1 is running OK"
++ fi
++ return 0
++ else
++ if [ $2 = 'verbose' ]
++ then
++ echo "Service $1 is NOT running"
++ fi
++ return 1
++ fi
++}
++
++BSDService_Start() {
++ BSDService_Status $1 noverbose
++ if [ $? -eq 0 ]
++ then
++ echo "Service $1 already running"
++ return 0
++ else
++ $RCD/$1 onestart
++ return $?
++ fi
++}
++
++BSDService_Stop() {
++ BSDService_Status $1 noverbose
++ if [ $? -eq 0 ]
++ then
++ $RCD/$1 onestop
++ return $?
++ else
++ echo "Service $1 already stopped"
++ return 0
++ fi
++}
++
++if [ $# -ne 2 ]
++then
++ usage; exit 1;
++fi
++
++case $2 in
++ start) BSDService_Start $1 ;;
++ stop) BSDService_Stop $1 ;;
++ status) BSDService_Status $1 verbose ;;
++ *) usage
++ exit 1;;
++esac
++exit $?
++