User Tools

Site Tools


en:linux:scripts:cr

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:linux:scripts:cr [2010/01/19 14:19] (current)
Line 1: Line 1:
 +===== /​mnt/​pctotem31/​bin/​cr =====
 +
 +A convenience tool to run srcam/​cmsRun/​runTotemDQM by one command.
 +
 +<​code>​
 +#!/bin/bash
 +
 +searchDirs=("​."​ "​$CMSSW_BASE/​src"​ "​$CMSSW_BASE/​user"​)
 +
 +function PrintUsage()
 +{
 + echo "​USAGE:​ cr [-b dir] [-bf dir] [cfg file] [cfg file] ..."
 +}
 +
 +if [ -z "​$1"​ ]
 +then
 + PrintUsage
 + exit 1
 +fi
 +
 +# default executable
 +executable="​cmsRun"​
 +
 +# loop over arguments
 +while [ -n "​$1"​ ]
 +do
 + case "​$1"​ in
 + -b*)
 + # building part
 + opt=$1
 + opt=${opt##​-b}
 +
 + shift
 + echo ">>​ Building [0;​31m$1"​ >&2
 + dir="​$CMSSW_BASE/​src/​$1"​
 + if [ ! -d "​$dir"​ ]
 + then
 + echo "​ ERROR:​ Module $dir doesn'​t exist."​
 + exit 1
 + fi
 +
 + cd "​$dir"​
 + sc b "​-$Opt"​
 + result="​$?"​
 + cd - > /dev/null
 +
 + if [ "​$result"​ -ne "​0"​ ]
 + then
 + echo "​ ERROR during build"
 + exit 1
 + fi
 + ;;
 +
 + "​-d"​)
 + executable='​runTotemDQM'​
 + ;;
 +
 + "​-c"​)
 + executable='​cmsRun'​
 + ;;
 +
 + *)
 + # running part
 + found="​0"​
 + for dir in ${searchDirs[@]}
 + do
 + if [ -f "​$dir/​$1"​ ]
 + then
 + echo ">>​ Running $executable [0;​31m$dir/​$1"​ >&2
 + found="​1"​
 + $executable "​$dir/​$1"​
 + break
 + fi
 + done
 +
 + if [ "​$found"​ -ne "​1"​ ]
 + then
 + echo ">>​ File [0;​31m$1 not found in any of search directories."​
 + fi
 + ;;
 + esac
 +
 + shift
 +done
 +</​code>​
  
en/linux/scripts/cr.txt · Last modified: 2010/01/19 14:19 (external edit)