MT#5715 use locking before write to fifo

(cherry picked from commit 36798db53e111a2196e7ae16dcfc6abe993a1948)
(cherry picked from commit a8a405b3a4e563fcb535ac2b44e5d30ad5af728a)
MT#7901 Add START_DAEMON check on /etc/default/heartbeat-2

(cherry picked from commit f496a85c3b189bb0d96ac9e7267c08384c1cf53a)