0

I have app on Ruby on Rails. It has email mailing. After deploy my sidekiq-cron doesn't send email. Worker doesn't start a job. It works only when i connect to server on ssh. Can anyone help me? Sidekiq-cron works localy.

I use

grep sidekiq /var/log/syslog

When I disconnect from server I see that:

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!

and when I connect by 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

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/sidekiq.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_worker

Gemfile

gem 'redis'
gem 'sidekiq'
gem 'sidekiq-cron'
gem 'capistrano-sidekiq'

version of sidekiq 6.1.2

1 Answers1

0

I fix it:

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.service