summaryrefslogtreecommitdiffstats
path: root/daemons/pacemakerd/pacemaker.combined.upstart.in
blob: af59ff05d14bce5754fd0322dc1c25674e814b3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# pacemaker-corosync - High-Availability cluster
#
# Starts Corosync cluster engine and Pacemaker cluster manager.

# if you use automatic start, uncomment the line below.
#start on started local and runlevel [2345]

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

pre-start script
    pidof corosync || start corosync

    # if you use corosync-notifyd, uncomment the line below.
    #start corosync-notifyd

    # give it time to fail.
    sleep 2
    pidof corosync || { exit 1; }

    # if you use crm_mon, uncomment the line below.
    #start crm_mon
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"

    # if you use corosync-notifyd, uncomment the line below.
    #stop corosync-notifyd || true

    # if you use watchdog of corosync, uncomment the line below.
    #pidof corosync || false

    pidof pacemaker-controld || stop corosync

    # if you want to reboot a machine by watchdog of corosync when
    # pacemakerd disappeared unexpectedly, uncomment the line below
    # and invalidate above "respawn" stanza.
    #pidof pacemaker-controld && killall -q -9 corosync

    # if you use crm_mon, uncomment the line below.
    #stop crm_mon

end script