-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcallparallelcurl.sh
More file actions
executable file
·52 lines (45 loc) · 871 Bytes
/
callparallelcurl.sh
File metadata and controls
executable file
·52 lines (45 loc) · 871 Bytes
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
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Missing file..."
exit
fi
echo "Starting..."
D=`date +%Y%m%d%H%M`
CONCUR=10
MAXTIME=30
COUNT=0
i=-1
IDS=""
WC=`wc -l $1 | cut -d" " -f1`
let WC=$WC-1
while read line
do
url=`echo $line | cut -d, -f1`
out=`echo $line | cut -d, -f2`
F="${out}.html"
let i=$i+1
if [ -s "${F}" ]
then
continue
fi
let COUNT=$COUNT+1
echo $i $COUNT
let CYCLE=$COUNT%$CONCUR
echo ${CYCLE}
IDS="${IDS} ${line}"
echo ${IDS}
if [ ${CYCLE} -eq 0 ] || [ ${WC} -le $i ]
then
${HOME}/bin/parallel -j ${CONCUR} -t ${MAXTIME} -r "${HOME}/bin/parallelcurl.sh *" ${IDS}
IDS=""
sleep 1
date
fi
done < $1
if [ ${CYCLE} -ne 0 ]
then
${HOME}/bin/parallel -j ${CONCUR} -t ${MAXTIME} -r "${HOME}/bin/parallelcurl.sh *" ${IDS}
date
echo "COMPLETE"
fi