From 825d7ed0a120c11f2e61ebdcec7c210b3e04797e Mon Sep 17 00:00:00 2001 From: Louwrentius Date: Thu, 13 May 2010 23:14:27 +0000 Subject: [PATCH] Cleaned up daemon mode. --- ppss | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/ppss b/ppss index a23d616..efd458a 100755 --- a/ppss +++ b/ppss @@ -117,6 +117,7 @@ REMOTE_OUTPUT_DIR="" # Remote directory to which output must SCRIPT="" # Custom user script that is executed by ppss. ITEM_ESCAPED="" NODE_STATUS="$PPSS_DIR/status.txt" +DAEMON=0 showusage_short () { @@ -689,6 +690,14 @@ do esac done +if [ "$DAEMON" == "1" ] && [ -z "$SRC_DIR" ] +then + showusage_short + echo + echo "Daemon mode requires an argument to the -d option as a place to put the lock dir." + echo "Read the on-line manual for more information." + exit +fi display_header () { @@ -709,7 +718,6 @@ create_working_directory () { fi } - expand_str () { STR=$1 @@ -744,7 +752,7 @@ log () { LOG_MSG="$PREFIX $MESG" ECHO_MSG="$PREFIX_SMALL $MESG" - if [ ! -z "$PPSSDEBUG" ] && [ ! "$PPSSDEBUG" == "0" ] + if [ ! -z "$PPSS_DEBUG" ] && [ ! "$PPSS_DEBUG" == "0" ] then echo -e "$LOG_MSG" >> "$LOGFILE" @@ -2024,11 +2032,11 @@ listen_for_job () { if [ "$QUIET" == "0" ] then log PRCNT "Currently $PERCENT percent complete. Processed $ARRAY_POINTER of $SIZE_OF_ARRAY items." - else + elif [ "$DAEMON" == "0" ] + then echo -en "\r$PERCENT%" fi - if [ "$PERCENT" == "100" ] then if [ "$QUIET" == "1" ] @@ -2073,11 +2081,14 @@ start_all_workers () { if [ "$MAX_NO_OF_RUNNING_JOBS" == "1" ] then - log DSPLY "Starting $MAX_NO_OF_RUNNING_JOBS single worker." + log DSPLY "Starting one (1) single worker." else log DSPLY "Starting $MAX_NO_OF_RUNNING_JOBS parallel workers." fi - log DSPLY "---------------------------------------------------------" + if [ "$DAEMON" == "0" ] + then + log DSPLY "---------------------------------------------------------" + fi i=0 while [ "$i" -lt "$MAX_NO_OF_RUNNING_JOBS" ]