summaryrefslogtreecommitdiffstats
path: root/bin/sync-osm-planet.sh
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-03-15 22:02:41 +0100
committersyncer <root@plopp.spline.de>2012-03-15 22:02:41 +0100
commit6e1dd2516f260a0361d65b58509106a615d0c149 (patch)
treeffd6c02e8b1b21e3182a3ed502f8644898d4db98 /bin/sync-osm-planet.sh
parent657d1fc484fa0b21b979525a92ace5c9e6f63da2 (diff)
downloadmirror-sync-6e1dd2516f260a0361d65b58509106a615d0c149.tar.gz
mirror-sync-6e1dd2516f260a0361d65b58509106a615d0c149.tar.bz2
mirror-sync-6e1dd2516f260a0361d65b58509106a615d0c149.zip
syncer scripts: move locking to cronwrapper
now lockfile-progs is used as replacement for the lockfile command of procmail
Diffstat (limited to 'bin/sync-osm-planet.sh')
-rwxr-xr-xbin/sync-osm-planet.sh68
1 files changed, 31 insertions, 37 deletions
diff --git a/bin/sync-osm-planet.sh b/bin/sync-osm-planet.sh
index 878ad5b..df9b538 100755
--- a/bin/sync-osm-planet.sh
+++ b/bin/sync-osm-planet.sh
@@ -22,43 +22,37 @@ TRACKER=(
"udp://tracker.openbittorrent.com:80/announce" )
MKTORRENT_OPTS=( "-l 22" )
-lockfile=/tmp/`basename $0`.lock
-
-if lockfile -r 5 $lockfile
-then
- ${RSYNC} "${RSYNC_OPTS[@]}" ${SRC} ${DST}
-
- # create torrents
- for file in ${DST}/*.bz2
- do
- archiv="$(basename $file)"
- if [ ! -L ${file} ]
+${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
- 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"
+ 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
- done
+ else
+ target="$(readlink ${file})"
+ ln -sf "$(basename ${target}).torrent" "${DST}/torrents/${archiv}.torrent"
+ fi
+done
- echo "End: $(date)"
- rm -f $lockfile
-fi
+echo "End: $(date)"