我在Ruby on Rails上有应用程序。它有电子邮件功能。部署后,我的sidekiq cron不会发送电子邮件。Worker不会启动作业。只有当我连接到ssh上的服务器时,它才能工作。有谁可以帮我?Sidekiq-cron在本地运行。
我使用
grep sidekiq /var/log/syslog当我断开与服务器的连接时,我看到:
Stopping sidekiq for kdl (production)...
pid=20692 tid=6hkqs INFO: Shutting down
pid=20692 tid=13ozxo INFO: Scheduler exiting...
pid=20692 tid=6hkqs INFO: Terminating quiet workers
pid=20692 tid=13p0b0 INFO: Scheduler exiting...
pid=20692 tid=6hkqs INFO: Pausing to allow workers to finish...
pid=20692 tid=6hkqs INFO: Bye!当我通过ssh连接时
pid=21478 tid=2fo8q INFO: Cron Jobs - add job with name: test_cron_minutes
pid=21478 tid=2fo8q INFO: Booted Rails 6.0.3.4 application in production environment
pid=21478 tid=2fo8q INFO: Running in ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
pid=21478 tid=2fo8q INFO: See LICENSE and the LGPL-3.0 for licensing details.
pid=21478 tid=2fo8q INFO: Upgrade to Sidekiq Pro for more features and support: https://sidekiq.org/config/initializer/sidekiq.rb kiq.rb
schedule_file = 'config/schedule.yml'
if File.exist?(schedule_file) && Sidekiq.server?
Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file)
end/config/idekiq.yml
:concurrency: 1
:queues:
-default
-mailers
-test_worker
-send_to_subscribed_worker/config/schedule.yml
send_to_subscribed_job:
cron: "0 12 * * Mon,Thu"
class: "SendToSubscribedWorker"
queue: send_to_subscribed_worker
test_cron_minutes:
cron: "* * * * *"
class: "TestWorker"
queue: test_workerGemfile
gem 'redis'
gem 'sidekiq'
gem 'sidekiq-cron'
gem 'capistrano-sidekiq'sidekiq 6.1.2版本
发布于 2020-12-25 22:36:55
我修复了它:
loginctl enable-linger deploy
systemctl --user daemon-reload
systemctl --user stop sidekiq-production.service
systemctl --user daemon-reload
systemctl --user start sidekiq-production.service
systemctl --user enable sidekiq-production.servicehttps://stackoverflow.com/questions/65439707
复制相似问题