messed up

This commit is contained in:
Louwrentius 2009-03-01 20:32:28 +00:00
parent c231b8e05a
commit 628e93c904

49
ppss.sh
View File

@ -631,7 +631,7 @@ get_no_of_cpus () {
got_cpu_info () { got_cpu_info () {
ERROR="$1" ERROR="$1"
check_status "$ERROR" "$FUNCNAME" "cannot determine number of cpu cores. Please specify a number of parallell processes manually with -p." check_status "$ERROR" "$FUNCNAME" "cannot determine number of cpu cores. Specify with -p."
} }
@ -783,27 +783,22 @@ upload_item () {
return 1 return 1
fi fi
if [ -e "$PPSS_LOCAL_OUTPUT/$ITEM" ] log DEBUG "Uploading item $ITEM."
if [ "$SECURE_COPY" == "1" ]
then then
log DEBUG "Uploading item $ITEM." scp -q $SSH_OPTS $SSH_KEY $PPSS_LOCAL_OUTPUT/"$ITEM"/* $USER@$SSH_SERVER:~/$REMOTE_OUTPUT_DIR
if [ "$SECURE_COPY" == "1" ] ERROR="$?"
if [ ! "$ERROR" == "0" ]
then then
scp -q $SSH_OPTS $SSH_KEY $PPSS_LOCAL_OUTPUT/"$ITEM" $USER@$SSH_SERVER:~/$REMOTE_OUTPUT_DIR log DEBUG "ERROR - uploading of $ITEM failed."
ERROR="$?"
if [ ! "$ERROR" == "0" ]
then
log DEBUG "ERROR - uploading of $ITEM failed."
fi
else
cp "$PPSS_LOCAL_OUTPUT/$ITEM" $REMOTE_OUTPUT_DIR
ERROR="$?"
if [ ! "$ERROR" == "0" ]
then
log DEBUG "ERROR - uploading of $ITEM failed."
fi
fi fi
else else
log DEBUG "ERROR: item $ITEM does not exist." cp "$PPSS_LOCAL_OUTPUT/$ITEM" $REMOTE_OUTPUT_DIR
ERROR="$?"
if [ ! "$ERROR" == "0" ]
then
log DEBUG "ERROR - uploading of $ITEM failed."
fi
fi fi
} }
@ -835,9 +830,6 @@ get_all_items () {
count=0 count=0
#does_file_exist "$SRC_DIR"
#check_status "$0" "$FUNCNAME" "ERROR - source dir $SRC_DIR does not exist."
if [ -z "$INPUT_FILE" ] if [ -z "$INPUT_FILE" ]
then then
if [ ! -z "$SSH_SERVER" ] # Are we running stand-alone or as a slave?" if [ ! -z "$SSH_SERVER" ] # Are we running stand-alone or as a slave?"
@ -967,6 +959,8 @@ start_single_worker () {
commando () { commando () {
ITEM="$1" ITEM="$1"
ITEM_NO_PATH="$1"
log DEBUG "Processing item $ITEM" log DEBUG "Processing item $ITEM"
if [ -z "$INPUT_FILE" ] && [ "$TRANSFER_TO_SLAVE" == "0" ] if [ -z "$INPUT_FILE" ] && [ "$TRANSFER_TO_SLAVE" == "0" ]
@ -979,6 +973,8 @@ commando () {
LOG_FILE_NAME=`echo "$ITEM" | sed s/^\\\.//g | sed s/^\\\.\\\.//g | sed s/\\\///g` LOG_FILE_NAME=`echo "$ITEM" | sed s/^\\\.//g | sed s/^\\\.\\\.//g | sed s/\\\///g`
ITEM_LOG_FILE="$JOB_LOG_DIR/$LOG_FILE_NAME" ITEM_LOG_FILE="$JOB_LOG_DIR/$LOG_FILE_NAME"
mkdir $PPSS_LOCAL_OUTPUT/"$ITEM"
does_file_exist "$ITEM_LOG_FILE" does_file_exist "$ITEM_LOG_FILE"
if [ "$?" == "0" ] if [ "$?" == "0" ]
then then
@ -1022,6 +1018,12 @@ commando () {
else else
log DEBUG "ERROR Something went wrong removing item $ITEM from local work dir." log DEBUG "ERROR Something went wrong removing item $ITEM from local work dir."
fi fi
fi
if [ ! -z "$REMOTE_OUTPUT_DIR" ]
then
upload "$PPSS_LOCAL_OUTPUT/$ITEM_NO_PATH/*"
fi fi
if [ ! -z "$SSH_SERVER" ] if [ ! -z "$SSH_SERVER" ]
@ -1185,11 +1187,6 @@ do
echo -en "\033[1B" echo -en "\033[1B"
log INFO "There are no more running jobs, so we must be finished." log INFO "There are no more running jobs, so we must be finished."
echo -en "\033[1B" echo -en "\033[1B"
if [ ! -z "$REMOTE_OUTPUT_DIR" ]
then
log INFO "Transfering all processed items back to server."
upload_item "$x"
fi
log INFO "Killing listener and remainig processes." log INFO "Killing listener and remainig processes."
log INFO "Dying processes may display an error message." log INFO "Dying processes may display an error message."
kill_process kill_process