supervise安裝與使用


確認當前是否已經安裝
which supervise
/usr/local/bin/supervise


軟件下載安裝
-----------------------------------------------------------------------------------------------------------------------------------------
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


命令執行
-----------------------------------------------------------------------------------------------------------------------------------------
cd /opt/scripts/
ls
mkdir test
cd 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用戶執行以下命令
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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM