Skip to content

run rake command without --silent #524

Closed
@anthonydahanne

Description

@anthonydahanne

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions