by
0
8
7,145
2
Top 1% !
Popular
Famous
Pearl of Wisdom
Tagged
Easy-to-find
Specified
OpenSource
Popularity: 853rd place

Published on:

Languagebash
LicenseMIT_X11
OSlinux

Setting a Clearcase view and run command remotely via SSH

This bash script allows user to set a IBM Rational Clearcase view on a remote machine and run a script on it via ssh.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/446/Setting-a-Clearcase-view-and-run-command?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
#!/bin/tcsh -e # Script to execute a cmd or script remotely via ssh on a target machine echo Executing make script: $0 echo Make targets: \"$*\" echo Working directory: $PWD set _CLEARCASE_VIEW = `cleartool pwv -short -setview` echo Set view: "$_CLEARCASE_VIEW" # check build server if ( $?BUILDHOST == 0 ) then echo "Error: variable BUILDHOST not set, build aborted." exit -1 endif # check clearcase view if ( "$_CLEARCASE_VIEW" == "** NONE **" ) then echo "Error: ClearCase view not set, build aborted." exit -1 endif # script parameters check... if ( "$1" == "" ) then echo "Error: missing 1st param!" echo "Eg: ./myscript par1 par2" exit -1 endif if ( "$1" == "" ) then echo "Error: missing 1st param!" echo "Eg: ./myscript par1 par2" exit -1 endif # create remote script set remote_script=$PWD/.${USER}@${HOST}-`basename $0` rm -rf $remote_script echo "myscript $1 $2" > $remote_script echo "rm -rf $remote_script" >> $remote_script chmod a+x $remote_script # exec script in the current view on the build server echo Executing build script: $remote_script echo via SSH on Host: $BUILDHOST echo ----- cat $remote_script echo ----- echo Starting remote build... ssh $BUILDHOST cleartool setview -exec $remote_script $_CLEARCASE_VIEW
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus