daemontools项目:http://cr.yp.to/daemontools.html
1.安装daemontools
mkdir /package chmod 755 /package cd /package wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz tar zxf daemontools-0.76.tar.gz cd admin/daemontools-0.76 vim src/error.h 找到:extern int errno; 改成:#include <errno.h> package/install
2.监控zookeeper
cd /service mkdir zookeeper cd zookeeper vim run chmod 755 run run内容如下: #!/bin/bash exec 2>&1 exec /root/zookeeper/zookeeper-3.4.5/bin/zkServer.sh start
3.运行supervise
nohup supervise /service/zookeeper &
4.实验
kill [zookeeper的pid] 马上一个新的zookeeper进程就出现了,enjoy it