Last active
January 15, 2017 18:22
-
-
Save czj/e0d9397fe85ab51cbcd18b2a20330b8d to your computer and use it in GitHub Desktop.
Running Rails 5.0.1 rake tasks without depreciation messages in cron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This triple redirection allows filtering STDERR by removing depreciation messages | |
# The second grep allows removing empty lines (which might trigger an email on some server) | |
cd /home/appname/www/current && (RAILS_ENV=production bundle exec rake myapp:mytask 3>&1 1>&2 2>&3 | grep -v 'is deprecated' ) 3>&1 1>&2 2>&3 | grep -v '' | |
# You can also log STDOUT to a log file | |
cd /home/appname/www/current && ((RAILS_ENV=production bundle exec rake myapp:mytask 3>&1 1>&2 2>&3 | grep -v 'is deprecated' ) 3>&1 1>&2 2>&3 | grep -v '') >> /home/appname/www/shared/log/taskoutput.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment