> ## Content Index
> Fetch the complete content index at: https://til.codes/llms.txt
> Use this file to discover other available public pages before exploring further.

# Script/runner vz Rake tasks
- URL: https://til.codes/script-runner-vz-rake-in-cron-job-rails/
- Published: 2017-01-07T13:52:00.000Z
- Updated: 2017-02-16T14:02:42.000Z
- Author: Manu Ajith
- Tags: ruby, rake, #Import 2024-07-13 21:01

When it comes to running Rails tasks the common question that comes to mind is whether to use `script/runner` or to call a `rake` task

```
script/runner long_running_task

VZ

rake long_running_task

```

To understand it better we need to understand how both works under the hood.

Whenever `script/runner` is called it boots the entire Rails

But on the other hand Rake task doesn't load the entire Rails app unless you tell it to by making the task depend on `:environment`, like this:

```
task :some_useful_task => :environment do
  # do some useful task
end

```

Since booting your Rails app is expensive each time, it might be worth skipping if you can avoid it.