login script when duplicate session [1]

login script when duplicate session

Thursday, January 11, 2018 12:23 PM - DL

Hi:
I'm trying to write a login script file that will execute when a new connection is established. It works well when I create a new session. But it seems the login-script is not executed when I duplicate a new one. Is there a way to archieve this?

What I'm trying to do is execute a script (in remote server) to initialize my work environment. And different session files will execute different bash files.
For example, there are three folder/work-environment in my home (game_dev, release, hot_fix). And I have three different session files (game_dev.xsh, release.xsh, hot_fix.xsh). And different work-environment needs different bash-files to initialize.

Basically, I need to pass name of the session file to remote server so that I can do something according to it. And I reliazed that it's very useful to have a bash-environment like 'XSHELL_SESSION_NAME=game_dev' .

Thanks!


xshell 5(1332)

Program Ver. : Xshell 5


Re: login script when duplicate session

Tuesday, January 16, 2018 1:22 AM - Support

When you say duplicate, you're referring to a session duplicate? If so, the ssh channel duplicate does not run the login script of a session file. Simply executing 'duplicate' should run the login script.

While utilizing the Xshell's shell environment is a good idea, but there are some difficulties transferring to the shell via protocol. The ssh server must be configured to the environment variables beforehand.

Personally, I'd use login script or some other script such as VB script which runs after completing login. I believe this is more suitable in your case.

If you'd like to use script, you can use the xsh.session.sessionname variable with the name of the current session.

Technical Support

Like us on Facebook
Follow us on Twitter
Visit our blog Blog


Previous views: 591