Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ampersand between RAILS_ENV=production and bundle exec rake ... #617

Closed
yepengfan opened this issue May 2, 2016 · 3 comments
Closed

Comments

@yepengfan
Copy link

yepengfan commented May 2, 2016

I got an issue that the cron job does not run properly on ubuntu server. I use capistrano with whenever gem.

I found the solution is to add ampersand after RAILS_ENV=production.
Changing from:
0 9 * * 5 /bin/bash -l -c 'cd /var/vhosts/myserver/current && RAILS_ENV=production bundle exec rake ...... --silent'
To
0 9 * * 5 /bin/bash -l -c 'cd /var/vhosts/myserver/current && RAILS_ENV=production && bundle exec rake ...... --silent'

Is there any configuration for whenever to solve this issue? Every time I need to manually change crontab file after deployment.

Thanks in advance.

@Exordian
Copy link

Exordian commented May 20, 2016

if you add another ampersand between RAILS_ENV and bundle you're ignoring the production environment, i guess you have configured your jobs to run only run in the development env

@karthickms
Copy link

Hi @yepengfan,

I use whenever gem but the cron job is not working for me on ubuntu production server. I used following command for every 2 minutes send the mail

02 * * * * /bin/bash -l -c 'cd /root/peatio/current && RAILS_ENV=production && bundle exec rake dailymail:email_sender --silent'

@benlangfeld
Copy link
Collaborator

@karthickms Please open your own issue rather than re-using unrelated tickets.

@yepengfan This is not a solution for any real problem and I think you're confused about what's going on here. You have an answer that should point you in the right direction. If you still have a problem, please explain what you mean by "not working" in more detail by including cron logs and potentially output from running the same command at a shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants