#!/usr/bin/perl # qpeek: Peek into a job's output spool files # Copyright 2001, Ohio Supercomputer Center # # Usage: qpeek [options] JOBID # # Options: # -c Show all of the output file ("cat", default) # -h Show only the beginning of the output file ("head") # -t Show only the end of the output file ("tail") # -f Show only the end of the file and keep listening ("tail -f") # -# Show only # lines of output # -e Show the stderr file of the job # -o Show the stdout file of the job # -? Display help $tool="cat"; $numlines=""; $suffix="OU"; $spool="/var/spool/pbs/spool"; $host="oscbw"; while ( $ARGV[0] =~ /^-.*/ ) { if ( $ARGV[0] eq "-c" ) { $tool="cat"; } elsif ( $ARGV[0] eq "-f" ) { $tool="tail -f"; } elsif ( $ARGV[0] eq "-h" ) { $tool="head"; } elsif ( $ARGV[0] eq "-t" ) { $tool="tail"; } elsif ( $ARGV[0] =~ /^-[0-9]+$/ ) { $numlines=$ARGV[0]; } elsif ( $ARGV[0] eq "-e" ) { $suffix="ER" } elsif ( $ARGV[0] eq "-o" ) { $suffix="OU" } elsif ( $ARGV[0] eq "-?" || $ARGV[0] eq "-help" ) { print STDERR < ) { chop; if ( $_ =~ /exec_host/ ) { ($keyword,$node)=split(/=/); $node=~s:/[0-9]+[A-z0-9/+]*::; } } $node; }