#!/bin/sh # -*-perl-*- #======================================================================# # Run the right perl version: if [ -x /usr/local/bin/perl ]; then perl=/usr/local/bin/perl elif [ -x /usr/bin/perl ]; then perl=/usr/bin/perl else perl=`which perl| sed 's/.*aliased to *//'` fi exec $perl -x -S $0 "$@" # -x: start from the following line #======================================================================# #! /Good_Path/perl -w #line 17 # # Name: reaper # Author: wd (wdobler [at] gmail [dot] com) # Date: 17-Jun-2008 # Description: # Run a shell script like run.csh and kill it and its child processes # after a given time, including subprocesses started via mpirun/mpiexec. # CAVEAT: As there is apparently no portable way to processes we # initiated via mpirun/mpiexec, we simply kill _any_ process of the # given name that didn't exist when this script started. # Usage: # reaper -t run.csh [] # Options: # -t , # --time= Kill all process of the given name after the given # time, possibly trying to softly shut it down some # time before. See `time_spec format'below for # details. # -h, --help This help # -v, --version Print version number # -q, --quiet Be quiet # Time_spec format: #