[Labs-l] SSH to labs instances with less typing
Marko Obrovac
mobrovac at wikimedia.org
Mon Mar 14 14:31:33 UTC 2016
Also note that the FQDN should include the project name as well (this is
not being currently enforced, though), so I'd amend the script with:
labs() {
host=$1
proj=$2
shift 2
[[ -z "$proj" ]] && proj="<insert_your_default_project_here>"
ssh "${host}.${proj}.eiad.wmflabs" "$@"
}
Marko
On 12 March 2016 at 23:42, Platonides <platonides at gmail.com> wrote:
> Aaron Halfaker wrote:
>
>> Hey folks,
>>
>> I have spent a little time today working out a cute little bash alias
>> trick for reducing my typing when connecting to various instances in
>> labs. Adding the following code to your /.bash_alias/ (or just
>> /.bashrc/) file will change $ ssh <your instance>.eqiad.wmflabs to $
>> labs <your instance>.
>>
>>
>> labs_ssh() {
>> ssh $1.eqiad.wmflabs
>> }
>> alias labs=labs_ssh
>>
>>
>> And there you have it. It's not much, but this helped my sanity a
>> little bit and I wanted to share.
>>
>
> Note that if you name the function labs, you won't need the alias. And you
> probably want to keep the ability to provide parameters to ssh, so:
>
> labs() {
> hostname="$1.eqiad.wmflabs"
> shift
> ssh "$hostname" "$@"
>
> }
>
> _______________________________________________
> Labs-l mailing list
> Labs-l at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/labs-l
>
--
Marko Obrovac, PhD
Senior Services Engineer
Wikimedia Foundation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.wikimedia.org/pipermail/labs-l/attachments/20160314/1afe8485/attachment.html>
More information about the Labs-l
mailing list