How can I see the result of Rake's automated daily tasks?

Our company uses rails as our server, and we recycle tasks daily without monitoring. When the rake is interrupted, we cannot receive intermittent information until we find that our data is strange.

How can I get rake cancellation information as soon as possible via email or any other means?

+3
source share
2 answers

Rake cron, MAILTO ( . man 5 crontab). cron , MAILTO.

, cron , , crontab ( , / ) script , .

crontab :

MAILTO=user@example.com

# This should work if your crontab environment knows about Ruby and Rake.
PATH=/path/to/ruby:$PATH
GEM_PATH=/path/to/gems
0 0 * * * cd /path/to/project; rake foo

# Otherwise, just create a shell script with a sane environment for running
# rake tasks, and call your rake tasks from the script.
1 0 * * * /path/to/your/script.sh
+1

All Articles