Whenever: run rake command without --silent

Created on 6 Jan 2015  ·  11Comments  ·  Source: javan/whenever

By default, the rake job type appends a --silent
There's no way to remove this --silent option to the rake command see :
https://github.com/javan/whenever/blob/master/lib/whenever/setup.rb#L24
A workaround is to rather use a command job type.
I successfully replaced :

rake "-s sitemap:refresh:no_ping" , :environment => 'development'

with :

command "cd #{path} && #{environment_variable}=development #{bundle_command} rake sitemap:refresh:no_ping"

It effectively wrote to the crontab :

# Begin Whenever generated tasks for: trailerpark-dev
* * * * * /bin/bash -l -c 'cd /Users/anthony/workspaces/coreytrevor && RAILS_ENV=development bundle exec rake sitemap:refresh:no_ping >> /Users/anthony/workspaces/coreytrevor/cron_log 2>&1'

Now I can enjoy the output of the rake command in my log file :

In '/Users/anthony/workspaces/coreytrevor/public/':
+ sitemap.xml.gz                                        1718 links /    13.8 KB
Sitemap stats: 1,718 links / 1 sitemaps / 0m00s

IMHO , it makes no sense to append the --silent argument, since nothing prevents the user from using -s in its rake command

Most helpful comment

You can always add your own type job for rake without the --silent option:

# schedule.rb
job_type :rake, "cd :path && :environment_variable=:environment :bundle_command rake :task :output"

All 11 comments

I have the same problem!

+1

+1
I faced the same issue!

+1

+1

+1

+1

+1 seriously.

why so serious

You can always add your own type job for rake without the --silent option:

# schedule.rb
job_type :rake, "cd :path && :environment_variable=:environment :bundle_command rake :task :output"

Closing because @javan's solution both works and is documented right there in the README. There is additionally a PR open to make this option directly configurable at https://github.com/javan/whenever/pull/541. Please follow there for further discussion of this issue.

Was this page helpful?
0 / 5 - 0 ratings