supervise the installation and use

Confirm whether the current installed
Which supervise
/ usr / local / bin / supervise


Software download and install
----------------------------------------------- -------------------------------------------------- ----------------------------------------
http://cr.yp.to/ daemontools / install.html
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz

tar -xvf daemontools-0.76.tar.gz
cd admin/daemontools-0.76


vim src/conf-cc
gcc -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings -include /usr/include/errno.h

package/install

# which supervise
/usr/local/bin/supervise


Command
------------------------------------------------ -------------------------------------------------- ---------------------------------------
cd / opt / scripts /
LS
mkdir the Test
cd the Test /

vim edate.sh
#! /bin/bash
echo `date +"%Y-%m-%d %H:%M:%S"`
sleep 5
vim run
#! /bin/sh
echo "start test /opt/scripts/test"
sh /opt/scripts/test/edate.sh

  

chmod +x run
cd ..
chown -R mysql.mysql test/

Mysql user and then execute the command
nohup supervise test /> /tmp/test_date.log &


$ ps -ef |grep sup
root 1219 1 0 Jul26 ? 00:00:00 /usr/local/bin/supervise /usr/local/addops/wonder-agent
mysql 5046 32154 0 11:07 pts/0 00:00:00 supervise test/

脚本输出
start test /opt/scripts/test
2019-09-30 11:09:23
start test /opt/scripts/test
2019-09-30 11:09:29
start test /opt/scripts/test
2019-09-30 11:09:34
start test /opt/scripts/test
2019-09-30 11:09:39
start test /opt/scripts/test
2019-09-30 11:09:44
start test /opt/scripts/test
2019-09-30 11:09:49
start test /opt/scripts/test
2019-09-30 11:09:54
start test /opt/scripts/test

 

Guess you like

Origin www.cnblogs.com/perfei/p/11611973.html