rust/cargo-c: update to 0.10.7+cargo-0.84.0
[oi-userland.git] / components / cluster / service-hacluster / files / svc-hacluster
blob06ab84999cf7b29b90fc87e1e7000062fb25dda3
1 #!/usr/bin/bash
2 # Start/stop HACluster service
4 . /lib/svc/share/smf_include.sh
6 ## Tracing with ebug version
7 # PCMK_trace_files=1
8 # PCMK_trace_functions=1
9 # PCMK_trace_formats=1
10 # PCMK_trace_tags=1
12 export PCMK_ipc_type=socket
13 export PCMK_logfile=/var/log/hacluster/pacemaker.log
15 export CLUSTER_USER=hacluster
16 export CLUSTER_GROUP=haclient
17 export PATH=/usr/gnu/bin:${PATH}
18 MYNAME=hacluster
19 APPPATH=/usr/sbin/
20 COROSYNC=corosync
21 PACEMAKERD=pacemakerd
22 PACEMAKER_PROCESSES=pacemaker
23 SLEEPINTERVALL=5
26 # all processes should log to the common folder /var/log/${MYNAME
27 [ ! -d /var/log/${MYNAME} ] && mkdir -p /var/log/${MYNAME}
29 # dumps of crashs, check the folder for problems
30 [ ! -d /var/lib/pacemaker/cores ] && mkdir -p /var/lib/pacemaker/cores
32 # runtime folder for sockets etc.
33 [ ! -d /var/lib/corosync ] && mkdir -p /var/lib/corosync
36 touch /var/log/${MYNAME}/${MYNAME}.log
37 chown ${CLUSTER_USER}:${CLUSTER_GROUP} /var/log/${MYNAME}/${MYNAME}.log
38 [ ! -d /var/run/${MYNAME} ] && mkdir -p /var/run/${MYNAME}
39 chown -R ${CLUSTER_USER}:${CLUSTER_GROUP} /var/run/${MYNAME}
41 killapp() {
42 pid=`pgrep -f $1`
43 if [ "x${pid}" != "x" ]; then
44 kill -9 ${pid}
46 return 0
49 start() {
50 stop
51 ${APPPATH}${COROSYNC}
52 sleep ${SLEEPINTERVALL}
53 ${APPPATH}${PACEMAKERD} &
54 return 0
57 stop() {
58 # first try, graceful shutdown
59 pid=`pgrep -f ${PACEMAKERD}`
60 if [ "x${pid}" != "x" ]; then
61 ${APPPATH}${PACEMAKERD} --shutdown
62 sleep ${SLEEPINTERVALL}
64 # second try, kill the rest
65 killapp ${APPPATH}${COROSYNC}
66 sleep 1
67 killapp ${PACEMAKER_PROCESSES}
68 return 0
71 case "$1" in
72 'start')
73 start
75 'restart')
76 stop
77 start
79 'stop')
80 stop
83 echo "Usage: -bash { start | stop | restart}"
84 exit 1
86 esac
87 exit 0