How to make custom Drush commands to work on remote instance I have developed custom Drush commands that includes some shell commands all which work locally. I would like them to work also on the remote instance with aliases that have the remote settings. Here is how the shell commands are currently executed:
//executes command

function execute_command($command)
{
    drush_log(dt('COMMAND: @command', array('@command' =&gt; $command)), 'notice');
    //any shell command fore example 'cp some/source dest/dir','tar xvf some.tgz',etc
    drush_shell_exec($command);
    drush_log(drush_shell_exec_output(), 'debug');
}


So, I would like to wrap this into some Drush API so they also execute on remote instance. Is it possible? How should I make the shell commands part of my custom Drush commands to run on the remote instance when user does something like:

drush @remote-alias custom-command


Thank You
I believe the remote site also has to have the commands as well in order to execute successfully.