File indexing completed on 2024-04-06 11:57:50
0001
0002
0003
0004
0005
0006
0007
0008 use Term::ANSIColor;
0009 use Cwd;
0010 use File::stat;
0011 use Time::localtime;
0012
0013
0014
0015
0016
0017
0018 $firstRun = "84000";
0019
0020 $lastRun = "130000";
0021
0022 $useMatacq = 1;
0023 $useShape = 0;
0024 $fitAB = 0;
0025 $linkName = "Cosmics09_310";
0026 $user = "ecallaser";
0027 $ecalPart = "";
0028 $nmaxjobshead = 3;
0029 $nmaxjobstot = 8;
0030
0031
0032 $runMon = 1;
0033 $runPrim = 0;
0034
0035 $machine=`uname -n`;
0036
0037 $mon_host_ebeven=`echo \${MON_HOSTNAME_EBEVEN}`;
0038 $mon_host_ebodd=`echo \${MON_HOSTNAME_EBODD}`;
0039 $mon_host_ee=`echo \${MON_HOSTNAME_EE}`;
0040 $mon_host_prim=`echo \${MON_HOSTNAME_PRIM}`;
0041
0042
0043 if ( $machine =~ /$mon_host_ebeven/ ){
0044 if( $ecalPart eq "") {
0045 $ecalPart="EBEven";
0046 }
0047 }elsif( $machine =~ /$mon_host_ebodd/ ){
0048 if( $ecalPart eq "") {
0049 $ecalPart="EBOdd";
0050 }
0051 }elsif( $machine =~ /$mon_host_ee/ ){
0052 if( $ecalPart eq "") {
0053 $ecalPart="EE";
0054 $runMon = 1;
0055 $runPrim = 0;
0056 }
0057 }elsif( $machine =~ /$mon_host_prim/ ){
0058 if( $ecalPart eq "") {
0059 $ecalPart="All";
0060 }
0061 $runMon = 0;
0062 $runPrim = 1;
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074 }else {
0075 print "unknown machine: $machine ... abort \n";
0076 die;
0077 }
0078
0079
0080
0081
0082
0083 if( $runMon==1 ){
0084
0085
0086 print color("red"), "\n\n***** You are about to run the monitoring with the following parameters: *****\n\n", color("reset");
0087
0088 print " machine = ${machine} ";
0089 print " firstRun = ${firstRun} \n ";
0090 print " lastRun = ${lastRun} \n ";
0091 print " useMatacq = ${useMatacq} \n ";
0092 print " useShape = ${useShape} \n ";
0093 print " fitAB = ${fitAB} \n ";
0094 print " linkName = ${linkName} \n ";
0095 print " user = ${user} \n ";
0096 print " ecalPart = ${ecalPart} \n ";
0097 print " nmaxjobshead = ${nmaxjobshead} \n ";
0098 print " nmaxjobstot = ${nmaxjobstot} \n ";
0099
0100 }
0101 if($runPrim==1){
0102
0103 print color("red"), "\n\n***** You are about to generate primitives with the following parameters: *****\n\n", color("reset");
0104
0105 print " machine = ${machine} ";
0106 print " linkName = ${linkName} \n ";
0107
0108 }
0109
0110
0111 $localdir = cwd;
0112 $proddir = "${localdir}/${linkName}";
0113 $scriptdir = "${proddir}/scripts";
0114 $musecaldir = "${proddir}/musecal";
0115 $logdir = "${proddir}/log";
0116
0117 my $isAnswerCorrect=0;
0118 my $answer=" ";
0119
0120 while( $isAnswerCorrect == 0 ){
0121 print color("red"), "\n\n Do you want to proceed? [yes/no] \n \n", color("reset");
0122 $answer=<STDIN>;
0123
0124 if ( $answer =~ /yes/ ){
0125
0126 print "... Proceeding \n";
0127
0128 my $curtime=time();
0129
0130 if( $runMon==1 ){
0131 my $log="${logdir}/LM_${ecalPart}_${curtime}.log";
0132 my $command = "nohup ${scriptdir}/LM.pl ${firstRun} ${lastRun} ${useMatacq} ${useShape} ${fitAB} ${linkName} ${user} ${ecalPart} ${nmaxjobshead} ${nmaxjobstot} > ${log} &";
0133 system $command;
0134 }
0135
0136 if( $runPrim==1 ){
0137
0138 my $log="${logdir}/Prim_${curtime}.log";
0139 my $command = "nohup ${musecaldir}/generatePrim.pl ${linkName} > ${log} &";
0140 system $command;
0141 }
0142
0143 $isAnswerCorrect=1;
0144 }elsif ( $answer =~ /no/ ){
0145 print "... Aborting \n";
0146 $isAnswerCorrect=1;
0147 }else{
0148 print "... Unknown answer \n";
0149 }
0150 }
0151
0152 exit;