source: src/django_gheat/import_scan_data.sh@ 9624

Last change on this file since 9624 was 9623, checked in by rick, 14 years ago

Merge and migrate all files into common files to get rid of all duplicate codes.

  • Property svn:executable set to *
File size: 1.5 KB
RevLine 
[9552]1#!/bin/sh
2#
3# Quick and dirty hack to import all data
4
[9564]5DATAROOT=${1:-"`pwd $0`/scan-data"}
6MAP_CACHE=${MAP_CACHE:-"/usr/local/var/httpd/cache/maps"}
[9555]7MANAGE="`dirname $0`/manage.py"
8SSH_USER=backup
9SSH_KEY="`dirname $0`/id_rsa"
10export PYTHON_EGG_CACHE=/tmp/
[9552]11
12echo "# rsync webfolder"
[9564]13rsync -e "ssh -i $SSH_KEY -l $SSH_USER -o StrictHostKeyChecking=no" -az tyan.wirelessleiden.nl:/usr/local/www/webfolder/scan-data/ $DATAROOT
[9552]14
[9555]15
[9552]16echo "# unzip compressed .tar.gz files"
[9566]17for FILE in `find $DATAROOT -name '*.tar.gz' | sort`; do
[9552]18 TARDIR=`dirname $FILE`
[9564]19 tar -C $TARDIR -xkzf $FILE
[9552]20done
21
[9564]22#Kismet netxml Imports
[9566]23FILES="`find $DATAROOT -name '*netxml*' | sort`"
[9623]24[ -n "$FILES" ] && $MANAGE import_common $ARGS $FILES
[9564]25
26# Import all measure data
[9566]27for USERDIR in `find $DATAROOT -mindepth 1 -maxdepth 1 -type d | sort`; do
28 for DEVICEDIR in `find $USERDIR -mindepth 1 -maxdepth 1 -type d | sort`; do
[9552]29 USERNAME=`basename $USERDIR`
30 DEVICE=`basename $DEVICEDIR`
31 ARGS="-g $USERNAME -e $USERNAME@wirelessleiden.nl -k $DEVICE"
[9564]32
[9566]33 echo $ARGS
[9564]34 #Kismet gpsxml Imports
[9566]35 FILES="`find $DEVICEDIR -name '*gpsxml*'`"
[9623]36 [ -n "$FILES" ] && $MANAGE import_datafile $ARGS $FILES
[9564]37
[9552]38 # DroidStumber imports
[9564]39 FILES=`find $DEVICEDIR -name 'ScanResult-*'`
[9623]40 [ -n "$FILES" ] && $MANAGE import_datafile $ARGS $FILES
41
42 # Kismet imports
43 FILES=`find $DEVICEDIR -name '*.ns1'`
44 [ -n "$FILES" ] && $MANAGE import_datafile $ARGS $FILES
[9552]45 done
46done
47
[9569]48if [ -r $MAP_CACHE ]; then
[9555]49 echo "# Clear cache $MAP_CACHE"
[9569]50 htcacheclean -v -l10K -p$MAP_CACHE
[9555]51fi
[9552]52
Note: See TracBrowser for help on using the repository browser.