安装supervisor
cd /root/tools/
wget http://pnxcvm0bq.bkt.clouddn.com/get-pip.py
python get-pip.py
pip install supervisor
mkdir /home/heron/supervisor && cd /home/heron/supervisor && mkdir bin conf log
cp /usr/bin/supervisor* /home/heron/supervisor/bin/
echo_supervisord_conf > /home/heron/supervisor/conf/supervisord.conf
sed -i "/chown/achown=heron:heron ; socket file uid:gid owner" /home/heron/supervisor/conf/supervisord.conf
sed -i "s/tmp/home/heron/supervisor/g" /home/heron/supervisor/conf/supervisord.conf
echo "python /home/heron/supervisor/bin/supervisorctl -c /home/heron/supervisor/conf/supervisord.conf $1 $2" > /home/heron/superctl
chmod +x /home/heron/superctl
python /home/heron/supervisor/bin/supervisord -c /home/heron/supervisor/conf/supervisord.conf
chown -R heron.heron /home/heron
##设置开机启动
cat >> /lib/systemd/system/supervisord.service << EOF
[Unit]
Description=Process Monitoring and Control Daemon
After=rc-local.service
[Service]
Type=forking
ExecStart=/usr/bin/python /home/heron/supervisor/bin/supervisord -c /home/heron/supervisor/conf/supervisord.conf
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
EOF
chmod +x /lib/systemd/system/supervisord.service
systemctl enable supervisord