As many of us using drush as command line tool for drupal for various task because it is easy to use and save time for searching dependency of module and libraries for various of module, In this tutorial we can see the how we use Drush in Crontab on server having different drupal instances.

If you have multiple drupal instance on single server and we want to use the drush then we have to navigate the root directory of drupal to the access and preform the task like module update , drupal update, themes update, or clear cache or etc. 

There are way to use the drush anywhere form your server using just the file called "aliases.drushrc.php"

Just follow the step given below

1) Login to shell using root access, install drush if not already installed

2) Now locate the ".drush" folder, it ususally at "~/.drush" path

3) Now create the file aliases.drushrc.php in that folder using command

vi ~/.drush/aliases.drushrc.php

4) Edit that file 

* @file aliases.drushrc.php
$aliases['web1'] = array (
 'uri' => 'domainname1.com',
 'root' => '/var/www/drupal1',
$aliases['web2'] = array (
 'uri' => 'domainname2.com',
 'root' => '/var/www/drupal2',


URI is your website domain name 

and root is your of that domain

5) save the file and for check its working using status commands

drush @web2 status 


drush @web1 status 

Note : web1 and web2 is just a name, your can use any name as you want

6) Status commands show your the drupal path and settings.php path if all goes well, then you can use it your crontab.


You can also use --uri or --root options, more details are here drush docs.

Please Comment your thoughts and feedback below and add something if you found good in anywhere to help others

Hit a like Button If you like the Post.

Many Thanks