supervise安裝與使用

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/

1

2

3

4

vim edate.sh

#! /bin/bash

echo `date +"%Y-%m-%d %H:%M:%S"`

sleep 5

1

2

3

4

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

發佈了155 篇原創文章 · 獲贊 21 · 訪問量 20萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章