So far you have seen most of the Drush command toolkit. Now it is time for us to think about how Drush can help us accomplish tasks that cannot be done with a few commands. Hence, it is time to write our own Drush command.
Here are some examples where you should choose to write a Drush command:
To run a periodic task that needs to be completely isolated because it can take a long time to complete and therefore cannot be executed through Cron
To extend the capabilities of an existing command in order to perform extra tasks needed in the production environments of your websites
To perform a task without a graphic interface, such as the content generator command of the Devel module
Drush commands follow a syntax very similar to Drupal. They are defined within a hook as an array of properties and a callback function does the processing. They also have hooks before, during, and after their execution. These will be explained in the next section.
Commands in Drush have the...