Added 2 cron jobs
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Wed, 11 Aug 2010 13:29:04 +0000 (13:29 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Wed, 11 Aug 2010 13:29:04 +0000 (13:29 +0000)
cron/iccat.cron [new file with mode: 0755]
cron/vesseltracker.cron [new file with mode: 0755]

diff --git a/cron/iccat.cron b/cron/iccat.cron
new file mode 100755 (executable)
index 0000000..9171312
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+umask 002
+sleep 26
+set -e
+
+#export MAILTO=contact_admin@nirgal.com,
+
+VARDIR=/var/lib/ais/iccat
+HTMLFILE=$VARDIR/`date -u +%Y%m%d`.html
+wget -q http://www.iccat.int/en/vesselsrecord.asp -O $HTMLFILE
+FILENAME=`python -m ais.iccat_getrarfilename $HTMLFILE`
+RARURL=http://www.iccat.int$FILENAME
+FILENAME=`basename $FILENAME`
+
+echo $RARURL>$VARDIR/newrar.url
+if ! diff -q $VARDIR/newrar.url $VARDIR/rar.url > /dev/null; then
+    echo New ICCAT file available at `cat $VARDIR/newrar.url`
+    wget -q `cat $VARDIR/newrar.url` -O $VARDIR/$FILENAME
+    mv $VARDIR/newrar.url $VARDIR/rar.url
+    # grep -v "ICCAT List Number" ICCAT_VESSELS_20100528.xls | iconv -f cp1252 -t utf-8 | cut -d $'\t' -f 1 | sort > ids_20100528
+else
+    rm $VARDIR/newrar.url
+fi
+rm $HTMLFILE
diff --git a/cron/vesseltracker.cron b/cron/vesseltracker.cron
new file mode 100755 (executable)
index 0000000..143004f
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+DATAFILE=/var/lib/ais/vesseltracker/`date -u +%Y-%m-%dT%H:%M:%S`.kmz
+wget -q http://www.vesseltracker.com:80/earth/publicdata.kmz -O $DATAFILE
+