#! /usr/bin/perl -w use strict; # # "now" script by Julen Larrucea # julen@larrucea.eu # Moab/Maui version (written for Juropa in the Jülich Supercomputing Center) # ### Build the array with all the info my @BULK = `showq |grep $USER` ; ##Defining the initial variables my $STATUS = ''; my $NPROC = ''; my $JID = ''; my $PATH = ''; my $START = ''; my $COLOR = ''; ##Printing the header of the output. print " \033[34m Running Jobs\033[0m \033[1;46;34m NYT \033[0m \n "; print "Status NProc JID Starting at Path \n "; #The blanks are right #print "\n"; foreach my $JOB (@BULK) # $JOB is each row for the array @BULK { $STATUS = (split(' ',$JOB))[2]; if ($STATUS =~ m/Running/) {$COLOR = '42;34' ; $STATUS = "\033[${COLOR}m R \033[0m" } # Print an "R" in green elsif ($STATUS =~ m/Idle/) {$COLOR = '47;33'; $STATUS = "\033[${COLOR}m I \033[0m"} # Print an "I" in orange elsif ($STATUS =~ m/Canceling/) {$COLOR = '38;41'; $STATUS = "\033[${COLOR}m C \033[0m"} #Print an "C" in red } $JID = (split(' ',$JOB))[0]; $NPROC = (split(' ',$JOB))[3]; $PATH = (split(' ', `checkjob $JID |grep IWD`))[1]; $START = (split('in ', `showstart $JID |grep start`))[1]; # chomp($STATUS); # Erasing the blanks before and after the words chomp($JID); chomp($PATH); chomp($START); print "$STATUS | $NPROC | $JID | $START | $PATH \n "; # print "------|-----|----------------|----------\n"; # } }; print "\n";