| 22 |
cd $root/incoming |
cd $root/incoming |
| 23 |
|
|
| 24 |
nice_wget() { |
nice_wget() { |
|
local failed |
|
|
failed="" |
|
| 25 |
# $1: url |
# $1: url |
| 26 |
# $2: filename |
# $2: filename |
| 27 |
# For timestamping to work, copy to .new (not link, wget will not break |
# For timestamping to work, copy to .new (not link, wget will not break |
| 28 |
# the link) |
# the link) |
| 29 |
cp -a $2 $2.new || true |
cp -a $2 $2.new || true |
| 30 |
# Beware that -N conflicts with -O (#88176, #202911) |
# Beware that -N conflicts with -O (#88176, #202911) |
| 31 |
wget -U pts -q -O $2.new $1 || { failed=1; } |
if wget -U pts -q -O $2.new $1 ; then |
| 32 |
if [ "$failed" = "1" ]; then |
mv $2.new $2 |
| 33 |
|
else |
| 34 |
echo "Downloading $1 failed, $2 is stale now" |
echo "Downloading $1 failed, $2 is stale now" |
| 35 |
rm -f $2.new |
rm -f $2.new |
|
else |
|
|
mv $2.new $2 |
|
| 36 |
fi |
fi |
| 37 |
} |
} |
| 38 |
|
|