small update
This commit is contained in:
		
							parent
							
								
									c7e64d1e80
								
							
						
					
					
						commit
						df5dd30d10
					
				@ -76,8 +76,8 @@ showusage () {
 | 
				
			|||||||
    echo
 | 
					    echo
 | 
				
			||||||
    echo -e "Example: encoding some wav files to mp3 using lame:"
 | 
					    echo -e "Example: encoding some wav files to mp3 using lame:"
 | 
				
			||||||
    echo 
 | 
					    echo 
 | 
				
			||||||
    echo -e "$0 -c 'lame /path/to/wavfiles/' -d /path/to/wavfiles -l logfile -j"
 | 
					    echo -e "$0 -c 'lame ' -d /path/to/wavfiles -l logfile -j (wach out for the space in -c)" 
 | 
				
			||||||
    
 | 
					    echo    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
kill_process () {
 | 
					kill_process () {
 | 
				
			||||||
@ -171,6 +171,7 @@ do
 | 
				
			|||||||
            if [ ! -e "$INPUT_FILE" ]
 | 
					            if [ ! -e "$INPUT_FILE" ]
 | 
				
			||||||
            then
 | 
					            then
 | 
				
			||||||
                echo "ERROR: input file $INPUT_FILE not found."
 | 
					                echo "ERROR: input file $INPUT_FILE not found."
 | 
				
			||||||
 | 
					                cleanup
 | 
				
			||||||
                exit 1
 | 
					                exit 1
 | 
				
			||||||
            fi
 | 
					            fi
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
@ -179,6 +180,7 @@ do
 | 
				
			|||||||
            if [ ! -e "$SRC_DIR" ]
 | 
					            if [ ! -e "$SRC_DIR" ]
 | 
				
			||||||
            then
 | 
					            then
 | 
				
			||||||
                echo "ERROR: directory $SRC_DIR does not exist."
 | 
					                echo "ERROR: directory $SRC_DIR does not exist."
 | 
				
			||||||
 | 
					                cleanup
 | 
				
			||||||
                exit 1
 | 
					                exit 1
 | 
				
			||||||
            fi
 | 
					            fi
 | 
				
			||||||
            ;; 
 | 
					            ;; 
 | 
				
			||||||
@ -187,6 +189,7 @@ do
 | 
				
			|||||||
            if [ -z "$COMMAND" ]
 | 
					            if [ -z "$COMMAND" ]
 | 
				
			||||||
            then
 | 
					            then
 | 
				
			||||||
                echo "ERROR: command not specified."
 | 
					                echo "ERROR: command not specified."
 | 
				
			||||||
 | 
					                cleanup
 | 
				
			||||||
                exit 1
 | 
					                exit 1
 | 
				
			||||||
            fi
 | 
					            fi
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
@ -221,13 +224,24 @@ do
 | 
				
			|||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Init log file
 | 
					# Init log file
 | 
				
			||||||
if [ -e "$LOGFILE" ]
 | 
					 | 
				
			||||||
then
 | 
					 | 
				
			||||||
    rm $LOGFILE
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
init_vars () {
 | 
					init_vars () {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [ -e "$LOGFILE" ]
 | 
				
			||||||
 | 
					    then
 | 
				
			||||||
 | 
					        rm $LOGFILE
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [ -z "$COMMAND" ]
 | 
				
			||||||
 | 
					    then
 | 
				
			||||||
 | 
					        echo
 | 
				
			||||||
 | 
					        echo "ERROR - no command specified."
 | 
				
			||||||
 | 
					        echo
 | 
				
			||||||
 | 
					        showusage
 | 
				
			||||||
 | 
					        cleanup
 | 
				
			||||||
 | 
					        exit 1
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    echo 0 > "$ARRAY_POINTER_FILE"
 | 
					    echo 0 > "$ARRAY_POINTER_FILE"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FIFO=$(pwd)/fifo-$RANDOM-$RANDOM
 | 
					    FIFO=$(pwd)/fifo-$RANDOM-$RANDOM
 | 
				
			||||||
@ -472,7 +486,8 @@ get_all_items () {
 | 
				
			|||||||
    SIZE_OF_ARRAY="${#ARRAY[@]}"
 | 
					    SIZE_OF_ARRAY="${#ARRAY[@]}"
 | 
				
			||||||
    if [ "$SIZE_OF_ARRAY" -le "0" ]
 | 
					    if [ "$SIZE_OF_ARRAY" -le "0" ]
 | 
				
			||||||
    then
 | 
					    then
 | 
				
			||||||
        echo "ERROR: source file seems to be empty."
 | 
					        echo "ERROR: source file/dir seems to be empty."
 | 
				
			||||||
 | 
					        cleanup
 | 
				
			||||||
        exit 1
 | 
					        exit 1
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -544,6 +559,11 @@ commando () {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ITEM="$1"
 | 
					    ITEM="$1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [ -z "$INPUT_FILE" ]
 | 
				
			||||||
 | 
					    then
 | 
				
			||||||
 | 
					        ITEM="$SRC_DIR/$ITEM"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    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"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -587,10 +607,10 @@ start_all_workers () {
 | 
				
			|||||||
# If this is called, the whole framework will execute.
 | 
					# If this is called, the whole framework will execute.
 | 
				
			||||||
main () {
 | 
					main () {
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    log DEBUG "---------------- START ---------------------"
 | 
					 | 
				
			||||||
    log INFO "$SCRIPT_NAME version $SCRIPT_VERSION"
 | 
					 | 
				
			||||||
    is_running    
 | 
					    is_running    
 | 
				
			||||||
    init_vars
 | 
					    init_vars
 | 
				
			||||||
 | 
					    log DEBUG "---------------- START ---------------------"
 | 
				
			||||||
 | 
					    log INFO "$SCRIPT_NAME version $SCRIPT_VERSION"
 | 
				
			||||||
    get_all_items
 | 
					    get_all_items
 | 
				
			||||||
    listen_for_job "$MAX_NO_OF_RUNNING_JOBS" &
 | 
					    listen_for_job "$MAX_NO_OF_RUNNING_JOBS" &
 | 
				
			||||||
    LISTENER_PID=$!
 | 
					    LISTENER_PID=$!
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user