# pacemaker - High-Availability cluster resource manager
#
# Starts pacemakerd

stop on runlevel [0123456]
kill timeout 3600
respawn

env prog=pacemakerd
env sysconf=@CONFIGDIR@/pacemaker
env rpm_lockdir=@localstatedir@/lock/subsys
env deb_lockdir=@localstatedir@/lock

script
    [ -f "$sysconf" ] && . "$sysconf"
    exec $prog
end script

post-start script
    [ -f "$sysconf" ] && . "$sysconf"
    [ -z "$LOCK_FILE" -a -d "$rpm_lockdir" ] && LOCK_FILE="$rpm_lockdir/pacemaker"
    [ -z "$LOCK_FILE" -a -d "$deb_lockdir" ] && LOCK_FILE="$deb_lockdir/pacemaker"
    touch "$LOCK_FILE"
    pidof $prog > "@localstatedir@/run/$prog.pid"
end script

post-stop script
    [ -f "$sysconf" ] && . "$sysconf"
    [ -z "$LOCK_FILE" -a -d "$rpm_lockdir" ] && LOCK_FILE="$rpm_lockdir/pacemaker"
    [ -z "$LOCK_FILE" -a -d "$deb_lockdir" ] && LOCK_FILE="$deb_lockdir/pacemaker"
    rm -f "$LOCK_FILE"
    rm -f "@localstatedir@/run/$prog.pid"
end script
