Remove the last vestiges of the update-aircraft-db cronjob.

This commit is contained in:
Oliver Jowett 2016-07-10 12:21:35 +01:00
parent ad3d0e4d74
commit b2aaa23984
6 changed files with 2 additions and 128 deletions

2
debian/control vendored
View file

@ -10,7 +10,7 @@ Vcs-Git: https://github.com/mutability/dump1090.git
Package: dump1090-mutability Package: dump1090-mutability
Architecture: any Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
Recommends: python(>=2.5), cron | cron-daemon, curl, lighttpd Recommends: python(>=2.5), lighttpd
Provides: fatsv-data-source Provides: fatsv-data-source
Description: ADS-B Ground Station System for RTL-SDR Description: ADS-B Ground Station System for RTL-SDR
Networked Aviation Mode S / ADS-B decoder/translator with RTL-SDR software Networked Aviation Mode S / ADS-B decoder/translator with RTL-SDR software

12
debian/cron-template vendored
View file

@ -1,12 +0,0 @@
## TEMPLATE FILE - This is used to create /etc/cron.d/dump1090-mutability ##
## The first three lines will be discarded ##
# Checks for updates to the VRS aircraft database once a day at around 5am;
# when an update is available, downloads it and regenerates the JSON data
# used by the webmap.
# NB: the minute value below is randomly generated on install, to avoid
# all installs hitting the server at the same time.
# m h dom mon dow user command
@MIN@ 5 * * * @USER@ test -x /usr/share/dump1090-mutability/update-aircraft-database.sh && /usr/share/dump1090-mutability/update-aircraft-database.sh --log-to-file

View file

@ -126,7 +126,6 @@ do_start()
fi fi
# create logfile with the appropriate permissions if not already there # create logfile with the appropriate permissions if not already there
# (the cronjob running as DUMP1090_USER wants to append to it)
touch $LOGFILE touch $LOGFILE
chown "$DUMP1090_USER":root $LOGFILE chown "$DUMP1090_USER":root $LOGFILE

View file

@ -21,8 +21,6 @@ NAME=dump1090-mutability
CONFIGFILE=/etc/default/$NAME CONFIGFILE=/etc/default/$NAME
SRCCONFIGFILE=$CONFIGFILE SRCCONFIGFILE=$CONFIGFILE
TEMPLATECONFIG=/usr/share/$NAME/config-template TEMPLATECONFIG=/usr/share/$NAME/config-template
CRONFILE=/etc/cron.d/$NAME
TEMPLATECRON=/usr/share/$NAME/cron-template
SEDSCRIPT=$CONFIGFILE.sed.tmp SEDSCRIPT=$CONFIGFILE.sed.tmp
subvar_raw() { subvar_raw() {
@ -111,7 +109,7 @@ case "$1" in
adduser --system --home /usr/share/$NAME --no-create-home --quiet "$RUNAS" adduser --system --home /usr/share/$NAME --no-create-home --quiet "$RUNAS"
fi fi
# create log if missing; change ownership if needed so the cronjob works # create log if missing; change ownership if needed
db_get $NAME/log-file db_get $NAME/log-file
touch $RET touch $RET
chown $RUNAS $RET chown $RUNAS $RET

View file

@ -22,8 +22,6 @@ set -e
case "$1" in case "$1" in
purge) purge)
rm -f /etc/default/dump1090-mutability rm -f /etc/default/dump1090-mutability
rm -f /etc/cron.d/dump1090-mutability
rm -rf /var/cache/dump1090-mutability
;; ;;
remove) remove)

View file

@ -1,109 +0,0 @@
#!/bin/bash
# This script checks for a new version of BasicAircraftLookup from
# the VRS website and, if one is available, downloads it and updates
# the dump1090 webmap json files.
set -e
# defaults that can be overridden:
VRS_URL=${VRS_URL:-http://www.virtualradarserver.co.uk/Files/BasicAircraftLookup.sqb.gz}
CACHEDIR=${CACHEDIR:-/var/cache/dump1090-mutability}
JSONDIR=${JSONDIR:-$CACHEDIR/db}
SQBDIR=${SQBDIR:-$CACHEDIR/sqb}
LOGFILE=${LOGFILE:-/var/log/dump1090-mutability.log}
UPDATESCRIPT=${UPDATESCRIPT:-/usr/share/dump1090-mutability/vrs-basicaircraft-to-json.py}
if [ -f /etc/default/dump1090-mutability ]
then
. /etc/default/dump1090-mutability
fi
ETAGFILE=$SQBDIR/BasicAircraftLookup.sqb.etag
SQBFILE=$SQBDIR/BasicAircraftLookup.sqb
CHECKMODIFIED=true
LOGTOFILE=false
while [ "$#" -gt 0 ]
do
case "$1" in
-f|--force) CHECKMODIFIED=false ;;
-l|--log-to-file) LOGTOFILE=true ;;
*) echo "unrecognized option: $1" >&2; exit 1 ;;
esac
shift
done
if $LOGTOFILE; then exec >>$LOGFILE 2>&1; fi
log() {
date "+%c $*" >&2
}
mkdir -p $CACHEDIR $JSONDIR $SQBDIR
rm -f $ETAGFILE.new $SQBFILE.new
log "Checking VRS server for an updated database.."
# get ETag
curl --silent --fail --include --head $VRS_URL | grep ETag >$ETAGFILE.new
# check for existing file
RETRIEVE=true
ARGS=""
if $CHECKMODIFIED && [ -f $SQBFILE ]
then
if [ -s $ETAGFILE -a -s $ETAGFILE.new ]
then
if cmp -s $ETAGFILE $ETAGFILE.new
then
log "Database not modified."
RETRIEVE=false
else
log "Database modified, will retrieve a new copy."
fi
else
# do an if-modified-since
log "Database possibly modified, will try to retrieve a new copy."
ARGS="-z $SQBFILE"
fi
fi
if $RETRIEVE
then
log "Retrieving database.."
curl --silent --fail --remote-time --retry 2 $ARGS -o $SQBFILE.new $VRS_URL
mv $ETAGFILE.new $ETAGFILE
if [ -f $SQBFILE.new ]
then
log "Decompressing database.."
zcat $SQBFILE.new >$SQBFILE
touch -r $SQBFILE.new $SQBFILE
rm $SQBFILE.new
else
log "Database not modified."
fi
fi
UPDATE=true
if $CHECKMODIFIED
then
if test -f $JSONDIR/last_update; then
if ! test $SQBFILE -nt $JSONDIR/last_update; then UPDATE=false; fi
fi
fi
if $UPDATE
then
log "Updating JSON files from database.."
mkdir -p $JSONDIR/new
$UPDATESCRIPT $SQBFILE $JSONDIR/new
rm -f $JSONDIR/*.json
mv $JSONDIR/new/*.json $JSONDIR/
touch -r $SQBFILE $JSONDIR/last_update
rmdir $JSONDIR/new
log "Done."
else
log "No update to JSON files needed."
fi