Closed (fixed)
Project:
Drush
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Jul 2012 at 04:09 UTC
Updated:
7 Aug 2012 at 19:51 UTC
When working with remote hosts, it would be very useful to be able to specify a bash command to automatically prefix any command executed remotely over SSH. For example:
$aliases['remote-site'] = array(
'remote-host' => 'remote-site.com',
'remote-user' => 'user',
'remote-host-prefix-command' => 'my-command',
// ...additional options...
);
In this example, for a command such as drush @remote-site status, _drush_backend_generate_command() would generate an SSH command with the prefix command automatically injected.
with remote-host-prefix-command:
ssh -o PasswordAuthentication=no user@remote-site.com 'my-command; drush --invoke --uri=site-uri --root=/site/root status 2>&1' 2>&1
without:
ssh -o PasswordAuthentication=no user@remote-site.com 'drush --invoke --uri=site-uri --root=/site/root status 2>&1' 2>&1
For my purposes, this would allow commands such as source ~/.bash_profile to be executed before the drush command (e.g. to add drush to the PATH).
This option could also accept an array of prefix commands.
Comments
Comment #1
greg.1.anderson commentedBash will execute the file ~/.bashrc for non-login shells. Often (e.g. on Ubuntu distributions), ~/.bashrc begins like this:
Set your $PATH before .bashrc exits, and you won't need backend invoke to add a prefix command.
Comment #2.0
(not verified) commentedfixed mistake