summaryrefslogtreecommitdiffstats
path: root/bin/sync-osm-planet.sh
blob: 01354d7eced0855c68e5f50f08ee227bff175e96 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash

RSYNC="/usr/bin/rsync"
SRC="rsync://planet.openstreetmap.org/planet/"
DST="/mirror/ftp/pub/openstreetmap/"
RSYNC_OPTS=(
    "-Hax"
    "--delete"
    "--delete-excluded"
    "--include=planet/"
    "--include=planet/$(date +%Y)/"
    "--include=pbf/"
    "--include=*-$(date +%y%m)*"
    "--include=*-$(date -d '-1month' +%y%m)*"
    "--include=*-$(date -d '-2month' +%y%m)*"
    "--include=*-$(date -d '-3month' +%y%m)*"
    "--include=*-latest*"
    "--exclude=*"
    "--filter=protect torrents/"
    #"--list-only"
    )

MKTORRENT="/usr/bin/mktorrent"
TRACKER=(
    "http://tracker.ipv6tracker.org:80/announce,udp://tracker.ipv6tracker.org:80/announce"
    "udp://tracker.publicbt.com:80/announce,http://tracker.publicbt.com:80/announce"
    "udp://tracker.openbittorrent.com:80/announce" )
MKTORRENT_OPTS=( "-l 22" )

${RSYNC} "${RSYNC_OPTS[@]}" ${SRC} ${DST}

# create torrents
#for file in ${DST}/*.bz2
#do
#   archiv="$(basename $file)"
#   if [ ! -L ${file} ]
#   then
#       torrent="${DST}/torrents/${archiv}.torrent"
#       torrent_tmp="/tmp/${archiv}.torrent"
#
#       if [ ! -e "${torrent}" ]
#       then
#           rm -f "${torrent_tmp}"
#
#           TRACKER_OPT=""
#           for t in "${TRACKER[@]}"
#           do
#               TRACKER_OPT="${TRACKER_OPT} -a ${t}"
#           done
#
#           ${MKTORRENT} ${TRACKER_OPT} "${MKTORRENT_OPTS[@]}" \
#               -w "http://ftp.spline.inf.fu-berlin.de/pub/openstreetmap/${archiv}" \
#               -w "http://planet.osm.org/${archiv}" \
#               "${file}" -o "${torrent_tmp}" > /dev/null && \
#           mv "${torrent_tmp}" "${torrent}"
#       fi
#   else
#       target="$(readlink ${file})"
#       ln -sf "$(basename ${target}).torrent" "${DST}/torrents/${archiv}.torrent"
#   fi
#done

echo "End: $(date)"