2 mirror scripts

This commit is contained in:
zzz
2010-02-04 14:32:35 +00:00
parent 77a17658c1
commit 768d4ce1e2
2 changed files with 49 additions and 0 deletions

40
mirror/downloads-mirror.sh Executable file
View File

@ -0,0 +1,40 @@
#
# Simple cron job to mirror the files from google code,
# since it doesn't have rsync and neither do our project servers.
# Note that the google RSS feed doesn't include old stuff,
# so you won't get all the old files when you start this,
# only the latest.
#
# If feed format changes this may break.
# No verification, checksums, etc.
# We could, I suppose, run gpg --verify on any .sig file and remove
# the .sig and base file if it fails.
#
# by zzz 2010-02
#
BASE=.
RSSURL='http://code.google.com/feeds/p/i2p/downloads/basic'
RSSFILE=$BASE/feed.rss
PUBLIC=$BASE/public_html
#
wget "$RSSURL" -O $RSSFILE
LINKS=`grep '<a href="' $RSSFILE |
cut -f 3 -d ';' |
cut -f 1 -d '&'`
#
for link in $LINKS
do
file=`basename "$link"`
if [ ! -f "$PUBLIC/$file" ]
then
mkdir -p $PUBLIC
wget $link -O "$PUBLIC/$file"
if [ "$?" -ne "0" ]
then
echo "Download of $link failed"
rm -f "$PUBLIC/$file"
else
echo "Download of $link successful"
fi
fi
done

9
mirror/website-mirror.sh Executable file
View File

@ -0,0 +1,9 @@
#
# courtesy of Kilroy
# modded by zzz
#
BASE=$HOME/public_html
cd $BASE
mtn -d i2p.mtn pull mtn.i2p2.de i2p.www
cd $BASE/i2p.www/
mtn up