clustershell
clustershell copied to clipboard
Maintain current dir (pwd) in interactive mode
It would be nice to maintain current dir (pwd) in interactive mode, to perform various operations on a large number of nodes. In the current implementation, need to give it for each line:
$ clush -bL -w node[1-100]
clush> cd /var ; cp -r log log.bkp
clush> cd /var/log; ls -1 -tr
node[1-100]:file.x
node[1-100]:file.y
node[1-100]:file.z
clush> cd /var/log ; rm file.x file.y
It would be fine to maintain pwd in interactive mode (maybe by retrieving 'pwd' value of ssh sessions after a command), so we can do:
$ clush -bL -w node[1-100]
clush> cd /var
clush> cp -r log log.bkp
clush> cd log
clush> ls -1 -tr
node[1-100]:file.x
node[1-100]:file.y
node[1-100]:file.z
clush> rm file.x file.y
[st-cea] Moving to 1.4 milestone due to 1.3 feature freeze.
Could be nice, but before adding that, the specs of the (future) clush interactive mode have to be well defined.
[st-cea] Now part of clush
interactive mode improvements expected for 1.4 (#15).
I'm glad that we've found a solution. Indeed, we will implement this specific feature by relying on the underlying shell itself (eg. ''bash''). So 1.4 clush
interactive mode will keep ssh connexions open and will write commands to remote bash processes thanks to the write()
feature of the Ssh worker. What we'll do is like:
$ cat | ssh node $SHELL
command1
command2
Pro's:
- $PWD and environ will automagically be kept as remote shells won't be closed after each command,
- as we are already ssh-connected to target nodes, we should see a significant commands execution speedup.
Con's:
- A new constraint is: '''
clush
's fanout >= number of target nodes''', as we keep connexions open duringclush
interactive session.
This last point should be minimized when version 2 is available.
Also, if this constraint is not met: after clush command execution, a warning might be displayed to the user saying that connexions have been closed and remote environment/PWD are not kept (and that he should increase the fanout value).
[st-cea] ''bump''
New milestone for this feature set to 1.7.