Created
April 7, 2016 09:38
-
-
Save josteinaj/efa1ca9be1ebce5517d8a91b1911e682 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
# make a copy with correct permissions - engine runs as user "pipeline2" | |
cp /mnt/input /tmp/input -r | |
chown pipeline2:pipeline2 -R /tmp/input | |
INPUT_DIR="/tmp/input" | |
OUTPUT_DIR="/mnt/output" | |
mkdir -p "$OUTPUT_DIR" | |
LOG_FILE="$OUTPUT_DIR/log.txt" | |
function log() { | |
echo "$1" >> $LOG_FILE | |
} | |
rm $LOG_FILE # clear log file | |
function convert() { | |
BOOKID="$1" | |
SIZE="$2" | |
log "============" | |
log "Book: $BOOKID" | |
log "Size: $SIZE" | |
START_TIME="`date --utc +"%Y-%m-%d %H:%M:%S"`" | |
START_TIME_SECONDS="`date -d"$START_TIME" +%s`" | |
log "Start time: $START_TIME" | |
dp2 nlb:dtbook-to-pef --i-source $INPUT_DIR/$BOOKID.xml --output $OUTPUT_DIR/$BOOKID | |
END_TIME="`date --utc +"%Y-%m-%d %H:%M:%S"`" | |
END_TIME_SECONDS="`date -d"$END_TIME" +%s`" | |
log "End time: $END_TIME" | |
JOB_DURATION="`expr $END_TIME_SECONDS - $START_TIME_SECONDS`" | |
log "Job duration: $JOB_DURATION" | |
NANOSECONDS_PER_BYTE="`expr $JOB_DURATION \* 1000000000 / 7305243`" | |
log "Nanoseconds per byte: $NANOSECONDS_PER_BYTE" | |
} | |
dp2 help # start engine | |
convert "552974" "2116" | |
convert "550284" "16277" | |
convert "552431" "48850" | |
convert "550148" "108732" | |
convert "553269" "160791" | |
convert "554569" "199066" | |
convert "554399" "231553" | |
convert "551848" "269908" | |
convert "554804" "313615" | |
convert "501093" "356464" | |
convert "555969" "394084" | |
convert "553098" "425451" | |
convert "501524" "471605" | |
convert "552739" "516117" | |
convert "550322" "605981" | |
convert "550247" "646081" | |
convert "554848" "692832" | |
convert "555509" "750191" | |
convert "553753" "823515" | |
convert "555809" "912341" | |
convert "553184" "1029108" | |
convert "555508" "1245523" | |
convert "552087" "1714976" | |
convert "554664" "2530072" | |
convert "501243" "3110150" | |
convert "555968" "4064705" | |
convert "555217" "5668545" | |
convert "555082" "6450225" | |
convert "501035" "7305243" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment