I have set of some (third-party) shell scripts, which are supposed to connect to remote host and start some daemons (hadoop, if that matters). These scripts rely heavily on hostname in order to configure pid folders, data directories etc.
What I need to do now is to create some test/development environment on single machine, using Arch, which means:
- configure /etc/hosts to provide some aliases to 127.0.0.1, like data1, data2, data3 (that's the trivial part)
- configure passwordless SSH access to localhost (which is also trivial)
- somehow set the hostname for current SSH session, like if I connect using 'ssh data1' - then hostname should be "data1" - and this is what I can't figure out.
so I need to solve 2 problems:
- how do I pass some environment variable or something like that to remote host, so it will be visible to all scripts there
- how do I set hostname on remote host for that session only
and all this happens on the same computer.