Cleaned up daemon mode.
This commit is contained in:
		
							parent
							
								
									2cae93e7ce
								
							
						
					
					
						commit
						825d7ed0a1
					
				
							
								
								
									
										23
									
								
								ppss
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								ppss
									
									
									
									
									
								
							@ -117,6 +117,7 @@ REMOTE_OUTPUT_DIR=""                    # Remote directory to which output must
 | 
				
			|||||||
SCRIPT=""                               # Custom user script that is executed by ppss.
 | 
					SCRIPT=""                               # Custom user script that is executed by ppss.
 | 
				
			||||||
ITEM_ESCAPED=""
 | 
					ITEM_ESCAPED=""
 | 
				
			||||||
NODE_STATUS="$PPSS_DIR/status.txt"
 | 
					NODE_STATUS="$PPSS_DIR/status.txt"
 | 
				
			||||||
 | 
					DAEMON=0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
showusage_short () {
 | 
					showusage_short () {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -689,6 +690,14 @@ do
 | 
				
			|||||||
    esac
 | 
					    esac
 | 
				
			||||||
done
 | 
					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 () {
 | 
					display_header () {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -709,7 +718,6 @@ create_working_directory () {
 | 
				
			|||||||
    fi
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
expand_str () {
 | 
					expand_str () {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    STR=$1
 | 
					    STR=$1
 | 
				
			||||||
@ -744,7 +752,7 @@ log () {
 | 
				
			|||||||
    LOG_MSG="$PREFIX $MESG"
 | 
					    LOG_MSG="$PREFIX $MESG"
 | 
				
			||||||
    ECHO_MSG="$PREFIX_SMALL $MESG"
 | 
					    ECHO_MSG="$PREFIX_SMALL $MESG"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ ! -z "$PPSSDEBUG" ] && [ ! "$PPSSDEBUG" == "0" ]
 | 
					    if [ ! -z "$PPSS_DEBUG" ] && [ ! "$PPSS_DEBUG" == "0" ]
 | 
				
			||||||
    then
 | 
					    then
 | 
				
			||||||
        echo -e "$LOG_MSG" >> "$LOGFILE"
 | 
					        echo -e "$LOG_MSG" >> "$LOGFILE"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2024,11 +2032,11 @@ listen_for_job () {
 | 
				
			|||||||
            if [ "$QUIET" == "0" ]
 | 
					            if [ "$QUIET" == "0" ]
 | 
				
			||||||
            then
 | 
					            then
 | 
				
			||||||
                log PRCNT "Currently $PERCENT percent complete. Processed $ARRAY_POINTER of $SIZE_OF_ARRAY items." 
 | 
					                log PRCNT "Currently $PERCENT percent complete. Processed $ARRAY_POINTER of $SIZE_OF_ARRAY items." 
 | 
				
			||||||
            else
 | 
					            elif [ "$DAEMON" == "0" ]
 | 
				
			||||||
 | 
					            then
 | 
				
			||||||
                echo -en "\r$PERCENT%"
 | 
					                echo -en "\r$PERCENT%"
 | 
				
			||||||
            fi
 | 
					            fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
            if [ "$PERCENT" == "100" ]
 | 
					            if [ "$PERCENT" == "100" ]
 | 
				
			||||||
            then
 | 
					            then
 | 
				
			||||||
                if [ "$QUIET" == "1" ]
 | 
					                if [ "$QUIET" == "1" ]
 | 
				
			||||||
@ -2073,11 +2081,14 @@ start_all_workers () {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if [ "$MAX_NO_OF_RUNNING_JOBS" == "1" ]
 | 
					    if [ "$MAX_NO_OF_RUNNING_JOBS" == "1" ]
 | 
				
			||||||
    then
 | 
					    then
 | 
				
			||||||
        log DSPLY "Starting $MAX_NO_OF_RUNNING_JOBS single worker."
 | 
					        log DSPLY "Starting one (1) single worker."
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        log DSPLY "Starting $MAX_NO_OF_RUNNING_JOBS parallel workers."
 | 
					        log DSPLY "Starting $MAX_NO_OF_RUNNING_JOBS parallel workers."
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    log DSPLY "---------------------------------------------------------"
 | 
					    if [ "$DAEMON" == "0" ]
 | 
				
			||||||
 | 
					    then
 | 
				
			||||||
 | 
					        log DSPLY "---------------------------------------------------------"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    i=0
 | 
					    i=0
 | 
				
			||||||
    while [ "$i" -lt "$MAX_NO_OF_RUNNING_JOBS" ]
 | 
					    while [ "$i" -lt "$MAX_NO_OF_RUNNING_JOBS" ]
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user