-
Notifications
You must be signed in to change notification settings - Fork 1
/
ks.move_files_from_crawldir.sh
executable file
·42 lines (42 loc) · 1.65 KB
/
ks.move_files_from_crawldir.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Dieses Skript verschiebt Dateien aus dem wpull-Arbeitsverzeichnis in das wpull-Outputverzeichnis.
# Das Verschieben wird nur durchgeführt, wenn im Arbeitsverzeichnis keine WARC-Datei mehr liegt.
# Dass im Arbeitsverzeichnis keine WARC-Datei mehr liegt bedeutet, dass der Crawl beendet ist.
# Grundsätzlich werden alle Dateien aus dem Arbeitsverzeichnis verschoben. Das Arbeitsverzeichnis wird anschließend gelöscht.
# Typische Dateien, die von der Verschiebung betroffen sind, sind Log-Dateien (cdncrawl.log, cdnparse.log, cdn.txt, crawl.log) und die DB-Dateien (*.db).
# Autor : I. Kuss
# Datum : 05.03.2020
echo "*************************************************************"
echo "BEGINN move files from crawldir " `date`
echo "*************************************************************"
jobDir=/opt/regal/wpull-data-crawldir
outDir=/opt/regal/wpull-data
cd $jobDir
for crawldir in `ls -d edoweb:*/20*/`; do
echo "crawldir=$crawldir"
cd $jobDir/$crawldir
for warcfile in *.warc.gz; do
if [ -e "$warcfile" ]; then
# WARC-Datei existiert, nichts verschieben
echo "Crawl läuft noch oder ist abgebrochen."
break
fi
# Dateien verschieben
echo "Crawl wurde abgeschlossen. Dateien werden verschoben."
mv * $outDir/$crawldir
aktdirname=`basename $PWD`
cd ..
rmdir $aktdirname
echo "Verzeichnis $PWD/$aktdirname wurde gelöscht."
if [ -z "$(ls -A $PWD)" ]; then
# aktuelles Verzeichnis ist leer
aktdirname=`basename $PWD`
cd ..
rmdir $aktdirname
echo "Verzeichnis $PWD/$aktdirname wurde gelöscht."
fi
done
done
echo "ENDE move files from crawldir " `date`
echo
exit 0