#!/bin/bash
/usr/sbin/ip_start
sed -i 's@to_syslog:.*yes@to_logfile: yes\nlogfile: /var/log/pacemaker/pacemaker.log@g' /etc/corosync/corosync.conf
/usr/share/corosync/corosync start > /dev/null 2>&1
pid=$(pidof pacemakerd)
if [ "$?" -ne 0 ]; then
mkdir -p /var/run
export PCMK_debugfile=$pcmklogs
(pacemakerd &) & > /dev/null 2>&1
sleep 5
pid=$(pidof pacemakerd)
if [ "$?" -ne 0 ]; then
echo "startup of pacemaker failed"
exit 1
fi
echo "$pid" > /var/run/pacemakerd.pid
fi
exit 0