wouterdebie / i2cssh

csshX like ssh tool for iTerm2
MIT License
547 stars 68 forks source link

general question | can we specify the port with {port} when using -x #119

Closed x-077 closed 1 year ago

x-077 commented 1 year ago

Hello,

Is it possible to specify the port when using -x ? it's necessary to specify the port for postgres client or cassandra ( -p <port> ).

Thanks

wouterdebie commented 1 year ago

-x pretty much disregards any ssh parameters and you can construct a command however you want. So let's say that you the following config:

version: 2
clusters:
  mycluster:
    - host1
    - host2

and you run i2cssh mycluster -x "myclient --some-param --another-param -p 8000 -h {host}", i2cssh will execute:

myclient --some-param --another-param -p 8000 -h host1 and myclient --some-param --another-param -p 8000 -h host2 in different terminal windows.

In other words, you can pass anything to -x and {host} will be substituted with the actual host.

x-077 commented 1 year ago

Hello @wouterdebie,

make sense, I will make aliases command and connect accordingly using -x .

Thank you, your tool make my life easier every day.

wouterdebie commented 1 year ago

Maybe a quick tip: you can configure custom_command in your ~/.i2csshrc as well to always override the command:

version: 2
clusters:
  my_ssh_cluster:
    hosts:
      - host1
      - host2
  my_pg_cluster:
    custom_command: pgsql -h {host} -p 5432
    hosts:
      - host1
      - host2

This way you can use i2cssh my_pg_cluster to connect to your cluster using psql instead of ssh.