#!/bin/bash NODES=$PBS_SERVER_HOME/server_priv/nodes CLUSTER_CONF=%%CONFPATH/%%CONFIG_FILE . $CLUSTER_CONF # cat fails if NODES doesn't exist touch $NODES # $4 == hostname $5 == number of procs grep -v $4 $NODES > $NODES.$$ if [[ -z "$5" && -z $NODENP ]]; then echo $4 >> $NODES.$$ elif [[ ! -z $5 ]]; then echo $4 np=$5 >> $NODES.$$ else echo $4 np=$NODENP >> $NODES.$$ fi cat $NODES.$$ | sort -g | uniq | egrep -v "(^$|^\W$)" > $NODES. mv $NODES. $NODES rm -f $NODES.$$