Added -q quiet option.
This commit is contained in:
parent
cf3b54e61e
commit
38812a58b6
56
ppss
56
ppss
@ -25,7 +25,7 @@ trap 'kill_process' SIGINT
|
|||||||
|
|
||||||
# Setting some vars.
|
# Setting some vars.
|
||||||
SCRIPT_NAME="Distributed Parallel Processing Shell Script"
|
SCRIPT_NAME="Distributed Parallel Processing Shell Script"
|
||||||
SCRIPT_VERSION="2.62"
|
SCRIPT_VERSION="2.63"
|
||||||
|
|
||||||
# The first argument to this script can be a mode.
|
# The first argument to this script can be a mode.
|
||||||
MODES="node start config stop pause continue deploy status erase kill ec2"
|
MODES="node start config stop pause continue deploy status erase kill ec2"
|
||||||
@ -73,6 +73,7 @@ STOP_SIGNAL="$PPSS_HOME_DIR/$PPSS_DIR/stop_signal" # Stop pr
|
|||||||
ARRAY_POINTER_FILE="$PPSS_DIR/ppss-array-pointer-$PID" # Pointer for keeping track of processed items.
|
ARRAY_POINTER_FILE="$PPSS_DIR/ppss-array-pointer-$PID" # Pointer for keeping track of processed items.
|
||||||
JOB_LOG_DIR="$PPSS_DIR/job_log" # Directory containing log files of processed items.
|
JOB_LOG_DIR="$PPSS_DIR/job_log" # Directory containing log files of processed items.
|
||||||
LOGFILE="$PPSS_DIR/ppss-log-$PID.txt" # General PPSS log file. Contains lots of info.
|
LOGFILE="$PPSS_DIR/ppss-log-$PID.txt" # General PPSS log file. Contains lots of info.
|
||||||
|
QUIET="0"
|
||||||
STOP="0" # STOP job.
|
STOP="0" # STOP job.
|
||||||
MAX_DELAY="0" # MAX DELAY between jobs.
|
MAX_DELAY="0" # MAX DELAY between jobs.
|
||||||
MAX_LOCK_DELAY="9" #
|
MAX_LOCK_DELAY="9" #
|
||||||
@ -641,6 +642,11 @@ do
|
|||||||
add_var_to_config UPLOAD_TO_SERVER "$UPLOAD_TO_SERVER"
|
add_var_to_config UPLOAD_TO_SERVER "$UPLOAD_TO_SERVER"
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
|
--quiet|-q )
|
||||||
|
QUIET="1"
|
||||||
|
add_var_to_config QUIET "$QUIET"
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
--user|-u )
|
--user|-u )
|
||||||
USER="$2"
|
USER="$2"
|
||||||
add_var_to_config USER "$USER"
|
add_var_to_config USER "$USER"
|
||||||
@ -727,11 +733,17 @@ log () {
|
|||||||
echo -e "$LOG_MSG" >> "$LOGFILE"
|
echo -e "$LOG_MSG" >> "$LOGFILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TYPE" == "DSPLY" ] || [ "$TYPE" == "ERROR" ] || [ "$TYPE" == "WARN" ]
|
if [ "$TYPE" == "DSPLY" ] || [ "$TYPE" == "ERROR" ] || [ "$TYPE" == "WARN" ] && [ "$QUIET" == "0" ]
|
||||||
|
then
|
||||||
|
echo -e "$ECHO_MSG"
|
||||||
|
elif [ "$TYPE" == "ERROR" ] && [ "$QUIET" == "1" ]
|
||||||
then
|
then
|
||||||
echo -e "$ECHO_MSG"
|
echo -e "$ECHO_MSG"
|
||||||
fi
|
fi
|
||||||
|
if [ "$TYPE" == "PRCNT" ]
|
||||||
|
then
|
||||||
|
echo -en "\r$ECHO_MSG"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1598,7 +1610,7 @@ elapsed () {
|
|||||||
SECS="$(expr $REMAINDER % 60)"
|
SECS="$(expr $REMAINDER % 60)"
|
||||||
MINS="$(expr $(expr $REMAINDER - $SECS) / 60)"
|
MINS="$(expr $(expr $REMAINDER - $SECS) / 60)"
|
||||||
|
|
||||||
RES=`printf 'Total processing time: %02d:%02d:%02d' $HOURS $MINS $SECS`
|
RES=`printf 'Total processing time (hh:mm:ss): %02d:%02d:%02d' $HOURS $MINS $SECS`
|
||||||
log DSPLY "$RES"
|
log DSPLY "$RES"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1863,16 +1875,19 @@ listen_for_job () {
|
|||||||
((DIED++))
|
((DIED++))
|
||||||
if [ "$DIED" -ge "$MAX_NO_OF_RUNNING_JOBS" ]
|
if [ "$DIED" -ge "$MAX_NO_OF_RUNNING_JOBS" ]
|
||||||
then
|
then
|
||||||
#kill_process
|
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
RES=$((MAX_NO_OF_RUNNING_JOBS-DIED))
|
RES=$((MAX_NO_OF_RUNNING_JOBS-DIED))
|
||||||
if [ "$RES" == "1" ]
|
if [ "$RES" == "1" ] && [ "$QUIET" == "0" ]
|
||||||
then
|
then
|
||||||
log DSPLY "$((MAX_NO_OF_RUNNING_JOBS-DIED)) job is remaining. "
|
log PRCNT "$((MAX_NO_OF_RUNNING_JOBS-DIED)) job is remaining. \n"
|
||||||
else
|
elif [ "$QUIET" == "0" ]
|
||||||
log DSPLY "$((MAX_NO_OF_RUNNING_JOBS-DIED)) jobs are remaining."
|
then
|
||||||
echo -en "\033[1A"
|
if [ "$DIED" == "1" ]
|
||||||
|
then
|
||||||
|
echo -en "\n"
|
||||||
|
fi
|
||||||
|
log PRCNT "$((MAX_NO_OF_RUNNING_JOBS-DIED)) jobs are remaining. "
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ "$event" == "$KILL_KEY" ]
|
elif [ "$event" == "$KILL_KEY" ]
|
||||||
@ -1909,14 +1924,12 @@ listen_for_job () {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
IFS=$oldIFS
|
IFS=$oldIFS
|
||||||
|
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
commando "$event" &
|
commando "$event" &
|
||||||
MYPID="$!"
|
MYPID="$!"
|
||||||
disown
|
disown
|
||||||
PIDS="$PIDS $MYPID"
|
PIDS="$PIDS $MYPID"
|
||||||
#log DEBUG "Event $event has pid $MYPID"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
get_global_lock
|
get_global_lock
|
||||||
@ -1926,12 +1939,21 @@ listen_for_job () {
|
|||||||
PERCENT=$((100 * $ARRAY_POINTER / $SIZE_OF_ARRAY ))
|
PERCENT=$((100 * $ARRAY_POINTER / $SIZE_OF_ARRAY ))
|
||||||
if [ "$DIED" == "0" ] && [ "$FINISHED" == "0" ]
|
if [ "$DIED" == "0" ] && [ "$FINISHED" == "0" ]
|
||||||
then
|
then
|
||||||
log DSPLY "Currently $PERCENT percent complete. Processed $ARRAY_POINTER of $SIZE_OF_ARRAY items."
|
if [ "$QUIET" == "0" ]
|
||||||
|
then
|
||||||
|
log PRCNT "Currently $PERCENT percent complete. Processed $ARRAY_POINTER of $SIZE_OF_ARRAY items."
|
||||||
|
else
|
||||||
|
echo -en "\r$PERCENT%"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$PERCENT" == "100" ]
|
if [ "$PERCENT" == "100" ]
|
||||||
then
|
then
|
||||||
|
if [ "$QUIET" == "1" ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
fi
|
||||||
FINISHED=1
|
FINISHED=1
|
||||||
else
|
|
||||||
echo -en "\033[1A"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -1956,6 +1978,10 @@ listen_for_job () {
|
|||||||
stop-ppss
|
stop-ppss
|
||||||
log DSPLY "Finished. Consult $JOB_LOG_DIR for job output."
|
log DSPLY "Finished. Consult $JOB_LOG_DIR for job output."
|
||||||
fi
|
fi
|
||||||
|
if [ "$QUIET" == "1" ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
fi
|
||||||
cleanup
|
cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user