[英]Monit failing to restart sidekiq
我正在嘗試監視以在CentOS服務器上重新啟動我的sidekiq服務。 在嘗試了多種解決方案之后,我很困惑,仍然無法啟動該服務。
我來自monit.d的sidekiq文件:
check process sidekiq
with pidfile /var/www/App/tmp/pids/sidekiq.pid
start program = "/bin/bash -l -c 'sudo cd /var/www/App && bundle exec sidekiq --index 0 --pidfile /var/www/App/tmp/pids/sidekiq.pid --environment production --logfile /var/www/App/log/sidekiq.log --daemon'" as uid deploy and gid deploy
stop program = "/bin/bash -l -c 'cd /var/www/App && bundle exec sidekiqctl stop /var/www/App/tmp/pids/sidekiq.pid 10'" as uid deploy and gid deploy
if totalmem is greater than 512 MB for 2 cycles then restart
if 3 restarts within 5 cycles then timeout
如果我手動運行啟動程序命令,它將啟動sidekiq正常,但monit似乎無能為力。 只是想出了:
[BST Oct 6 11:51:17] error : 'sidekiq' process is not running
[BST Oct 6 11:51:17] info : 'sidekiq' trying to restart
[BST Oct 6 11:51:17] info : 'sidekiq' start: /bin/bash
[BST Oct 6 11:52:47] error : 'sidekiq' failed to start
因此,它包括文件,但以某種方式無法從腳本啟動服務。
會是什么 一些權限問題?
您需要更新到最新的Monit版本(5.14)。 刪除當前的monit安裝並按照以下說明進行操作:
https://rtcamp.com/tutorials/monitoring/monit/
希望能幫助到你!
PS:在這里找到解決方案: https : //bitbucket.org/tildeslash/monit/issues/109/failed-to-stop-always-after-60-seconds
根據調試監控
我發現我需要設置PATH。
我的啟動程序:
/ bin / bash -c'cd / home / vagrant / apps / skylark / current; PATH = / home / vagrant / .rbenv / shims:/home/vagrant/.rbenv/bin:$ PATH包執行exec sidekiq -d -e production -C -P / home / vagrant / apps / skylark / shared / tmp / pids /sidekiq.pid -L /home/vagrant/apps/skylark/shared/log/sidekiq.log'
我認為問題出在您的用戶身上。 您需要使用部署用戶執行。
check process sidekiq
with pidfile /var/www/App/tmp/pids/sidekiq.pid
start program = "/bin/su - deploy -c 'sudo cd /var/www/App && bundle exec sidekiq --index 0 --pidfile /var/www/App/tmp/pids/sidekiq.pid --environment production --logfile /var/www/App/log/sidekiq.log --daemon'" as uid deploy and gid deploy
stop program = "/bin/su - deploy -c 'cd /var/www/App && bundle exec sidekiqctl stop /var/www/App/tmp/pids/sidekiq.pid 10'" as uid deploy and gid deploy
if totalmem is greater than 512 MB for 2 cycles then restart
if 3 restarts within 5 cycles then timeout
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.