diff bin/doPlinks.sh @ 6:0f494c76a887

refactor to address tarred-up pdfs
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Sun, 23 Feb 2020 16:48:34 +0000
parents a4b0359456bc
children 25ca3505b4d7
line wrap: on
line diff
--- a/bin/doPlinks.sh	Wed Feb 19 10:41:59 2020 +0000
+++ b/bin/doPlinks.sh	Sun Feb 23 16:48:34 2020 +0000
@@ -1,14 +1,17 @@
 #!/usr/bin/bash
-mkdir -p /dev/shm/x
-plinks.py $1
-# while read f
-# do
-#     if plinks.py $f > /dev/shm/x/links_${me}_${mine} 2>/dev/null
-#     then
-# 	((mine+=1))
-#     else
-# 	echo $f >> /dev/shm/x/badpdfs_$me
-# 	rm -f /dev/shm/x/links_${me}_${mine}
-#     fi
-# done
-rsync -a /dev/shm/x/ links
+hn=$1
+jn=$2
+tfn=$3
+
+mkdir -p /dev/shm/x$hn/${tfn}
+cd /dev/shm/x$hn/${tfn}
+tar -xf /beegfs/common_crawl/CC-MAIN-2019-35/pdfs/${tfn}.tar '*.pdf'
+echo $(date) $hn $(pwd) untarred ${tfn}.tar for job $jn
+ls *.pdf | sort --field-separator=_ -k1,1 -k2n,2 | cat -n |\
+plinks.py $tfn || { echo $(date) $hn aborted job $jn for $tfn \[remember to clean up\] ; rm -f /dev/shm/stopJob ; exit 1 ; }
+echo $(date) $hn tarring results from job $jn for $tfn in $(pwd)
+tar -cf /beegfs/common_crawl/CC-MAIN-2019-35/pdfs/links/${tfn}.tar badpdfs_${tfn} links_${tfn}_*
+rm *
+cd ..
+rmdir ${tfn}
+echo $(date) $hn finished job ${jn} for ${tfn}