使用 cronjob 定期重启 sidekiq

Restarting sidekiq periodically with a cronjob

我们目前正在使用 capistrano-sidekiq,这也处理了每次部署时 sidekiq 的自动重启。

但是,我们还希望每晚手动重启 sidekiq,而不重启整个应用程序。

应该使用哪个命令在生产机器上使用 crontab 条目在生产机器上自动重启 sidekiq?

找到现有的sidekiq进程并杀死它,然后重新启动sidekiq

至运行 Sidekiq

RAILS_ENV=production bundle exec sidekiq -d -L log/sidekiq.log -C config/sidekiq.yml

杀死sidekiq进程

RAILS_ENV=production bundle exec sidekiqctl stop tmp/pids/sidekiq.pid