'rbenv sidekiq whenever doesnt run from cron but runs if executed directly
I'm trying to make a code execute every 1 minute.
I have ruby rbenv, sidekiq and whenever installed. my user is deploy and part of deploy, sudo groups
my sidekiq service
[Unit]
Description=sidekiq
# start us only once the network and logging subsystems are available,
# consider adding redis-server.service if Redis is local and systemd-managed.
After=syslog.target network.target
[Service]
Type=simple
User=deploy
# If your Sidekiq process locks up, systemd's watchdog will restart it within seconds.
WatchdogSec=10
WorkingDirectory=/home/deploy/a7/current
ExecStart=/bin/bash -lc 'exec /home/deploy/.rbenv/shims/bundle exec sidekiq -e production'
Environment=MALLOC_ARENA_MAX=2
# if we crash, restart
RestartSec=1
Restart=on-failure
# output goes to /var/log/syslog (Ubuntu) or /var/log/messages (CentOS)
StandardOutput=syslog
StandardError=syslog
# This will default to "bundler" if we don't specify it
SyslogIdentifier=sidekiq
[Install]
WantedBy=multi-user.target
my crontab -l
# Begin Whenever generated tasks for: /home/deploy/a7/releases/20220307214617/config/schedule.rb at: 2022-03-08 18:44:14 +0000
* * * * * /bin/bash -l -c 'cd /home/deploy/a7/releases/20220307214617 && bundle exec bin/rails runner -e production '\''Bot.execute_for_subscribers'\'''
# End Whenever generated tasks for: /home/deploy/a7/releases/20220307214617/config/schedule.rb at: 2022-03-08 18:44:14 +0000
running this into the terminal works perfectly
/bin/bash -l -c 'cd /home/deploy/a7/releases/20220307214617 && bundle exec bin/rails runner -e production '\''Bot.execute_for_subscribers'\'''
but wont execute every minute.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
