by

Remote execution of command on clearcase view via ssh

This bash script allows to execute a dynamic command on a remote machine, using ssh authentication within a Clearcase dynamic view. 

Note that the command to run in generated by some variables and it's passed to ssh via a file. 

The cat command will input the command into remote shell to be executed on another machine.

You can find also the time evaluation of such command.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/5994/Remote-execution-of-command-on-clearcase?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
my_dest_path="/some/path/" # This return current directory currentDir=`pwd` # This return the CLearcase view name currentView=`cleartool pwv -s` echo "Setting view: ${currentView} on remote machine" # This is the command to execute cmd="cleartool setview -exec \"echo currentDir=${currentDir}; echo my_dest_path=${my_dest_path}; cd ${currentDir}; cp -an data/* ${my_dest_path}; hostname\" ${currentView}" echo "cmd=${cmd}" # This is a tmp file where to save the command file=.`hostname`-remote-cmd.txt rm -f ${file} # Create a tmp file to save the command to execute echo ${cmd} > ${file} # This run the command on <remoteMachine> /usr/bin/time -f "%E" -o ${my_platform_label}.time ssh -Y <remoteMachine> 'bash -s' < ${file}
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus