File indexing completed on 2024-11-19 23:20:32
0001
0002
0003
0004
0005
0006
0007
0008 usage()
0009 {
0010 echo "Usage:"
0011 echo " sh $0 [-n NCORE=36] COMMAND_LIST.txt [PATTERN]"
0012 exit
0013 }
0014
0015
0016 while getopts ":n:xh" OPTION; do
0017 case $OPTION in
0018 n) CORE=${OPTARG};;
0019 h) usage;;
0020 :) usage;;
0021 esac
0022 done
0023
0024
0025 shift $(($OPTIND - 1))
0026
0027 if [ -z ${CORE} ]; then CORE=36; fi
0028
0029 cores=${CORE}
0030
0031
0032 if [ "x${1}" == "x" ]; then
0033 echo "Error: Must provide the job commands txt file"
0034 usage
0035 exit
0036 fi
0037
0038 JOBTXTFILE=$1
0039
0040 MACRONAME=$(mktemp stupid_numbers_XXXXXXXXX)
0041 MACRO=/tmp/${MACRONAME}.txt
0042 rm $MACRONAME
0043
0044
0045 if [ "x${2}" != "x" ]; then
0046 cat $1 | grep -v '^#' | grep $2 > ${MACRO}
0047 else
0048 cat $1 | grep -v '^#' > ${MACRO}
0049 fi
0050
0051
0052 xargs --arg-file=${MACRO} \
0053 --max-procs=$cores \
0054 --replace \
0055 --verbose \
0056 /bin/sh -c "{}"
0057
0058