#!/usr/local/bin/perl ################################################################################## # makelinks.pl P. Woncik 1/26/99 # # for the FEI EDR passed, creates a symbolic link to it based on SOL and another # based on SEQ for easy navigation of your local directories via fileType # (as it is received from FEI) or by SOL and/or SEQ # # 3/17/99 Also fire off the RT display JAVA thingy - sending the file to the # local display server. Any RT Display clients registered to this server # will see the data display as FEI gets it (so within minutes of generation # in MIPS) **** NOTE **** you must modify the $rtdisp variable, specify your # machine running the RTD server - also check those java locations, # may be different on your system! # # # Syntax: # # makelinks.pl input_file FEI_fileType # ################################################################################## my($debug) = 0; # 1 if you want debug messages displayed to STDOUT, else use 0 ## ## initalize variables ## my ($filename) = $ARGV[0]; my ($filetype) = $ARGV[1]; my (@label,$label,$keyword,$value, $tmp, $missionPhaseName, $cmd, $filepath, $log); my ($rtdisp) = "/usr/bin/java -classpath /usr/java1.2/jre/lib/rt.jar:". "/usr/local/vicar/ops/java:". "/usr/local/vicar/ops/java/jpl/mipl/rtdisp ". "DisplayCommand your.local.machine 20202 "; ## figure out the path of the input EDR based on the fileType $tmp = substr($filetype,index($filetype,"_")+1); $missionPhaseName = substr($tmp,0,index($tmp,"_")); $filepath = "/project/mars98/$missionPhaseName/$filetype"; print "\nfilename = $filename, filetype = $filetype,". " path = $filepath\n" if ($debug); ## run RT display program if it is a regular image if ($filename =~ /s*[lrm]\.img/i) { $rtdisp = $rtdisp."$filepath/$filename SSILeft" if ($filename =~ /s*l\.img/i); $rtdisp = $rtdisp."$filepath/$filename SSIRight" if ($filename =~ /s*r\.img/i); $rtdisp = $rtdisp."$filepath/$filename RAC" if ($filename =~ /s*m\.img/i); print "Display Command = $rtdisp\n" if $debug; # `$rtdisp`; } ## parse label and make links to the EDR based on SEQUENCE and SOL my(%labelKeywords) = ("SEQUENCE_ID" => undef(), "PLANET_DAY_NUMBER" => undef()); @label = `/usr/local/vicar/ops/p2/lib/sun-solr/label -list $filepath/$filename -dump`; foreach $label (@label) { chomp($label); ($keyword,$value) = split("=",$label); print "label=$label keyword=$keyword value=$value\n" if $debug; foreach (keys (%labelKeywords)) { $labelKeywords{$_} = $value if ($_ eq $keyword); $labelKeywords{$_} =~ s/'//; } } $labelKeywords{"PLANET_DAY_NUMBER"} = "+".$labelKeywords{"PLANET_DAY_NUMBER"} if ($labelKeywords{"PLANET_DAY_NUMBER"} >= 0); $labelKeywords{"SEQUENCE_ID"} = "0" if ($labelKeywords{"SEQUENCE_ID"} =~ /\?/); `mkdir $filepath/seq$labelKeywords{"SEQUENCE_ID"}` unless (-e "$filepath/seq$labelKeywords{'SEQUENCE_ID'}"); `mkdir $filepath/sol$labelKeywords{"PLANET_DAY_NUMBER"}` unless (-e "$filepath/sol$labelKeywords{'PLANET_DAY_NUMBER'}"); $cmd = "ln -s $filepath/$filename $filepath/seq".$labelKeywords{"SEQUENCE_ID"}."/$filename"; print "SEQ Link Command = $cmd\n" if $debug; `$cmd` unless (-e "$filepath/seq".$labelKeywords{"SEQUENCE_ID"}."/$filename"); $cmd = "ln -s $filepath/$filename $filepath/sol".$labelKeywords{"PLANET_DAY_NUMBER"}."/$filename"; print "SOL Link Command = $cmd\n" if $debug; `$cmd` unless (-e "$filepath/sol".$labelKeywords{"PLANET_DAY_NUMBER"}."/$filename"); exit(0);