Changeset 9564


Ignore:
Timestamp:
Aug 25, 2011, 1:26:04 PM (13 years ago)
Author:
rick
Message:

Better import ordering

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/import_scan_data.sh

    r9555 r9564  
    33# Quick and dirty hack to import all data
    44
    5 if [ `id -un` != "www" ]; then
    6   echo "ERROR, run as www user: sudo -E -u www $0"
    7   exit 1
    8 fi
    9 
    10 DATAROOT="/usr/local/var/scan-data"
    11 MAP_CACHE=/usr/local/var/httpd/cache/maps
     5DATAROOT=${1:-"`pwd $0`/scan-data"}
     6MAP_CACHE=${MAP_CACHE:-"/usr/local/var/httpd/cache/maps"}
    127MANAGE="`dirname $0`/manage.py"
    138SSH_USER=backup
     
    1611
    1712echo "# rsync webfolder"
    18 rsync -e "ssh -i $SSH_KEY -l $SSH_USER -o StrictHostKeyChecking=no" -az tyan.wirelessleiden.nl:/usr/local/www/webfolder/scan-data/ $DATAROOT || exit 1
     13rsync -e "ssh -i $SSH_KEY -l $SSH_USER -o StrictHostKeyChecking=no" -az tyan.wirelessleiden.nl:/usr/local/www/webfolder/scan-data/ $DATAROOT
    1914
    2015
     
    2217for FILE in `find $DATAROOT -name '*.tar.gz'`; do
    2318  TARDIR=`dirname $FILE`
    24   if [ \! -r "$TARDIR/`tar -tf $FILE | head -1`" ]; then
    25     tar -C $TARDIR -xzf $file
    26   fi
     19  tar -C $TARDIR -xkzf $FILE
    2720done
    2821
    2922ADDED=0
    30 # Import all data
    31 for USERDIR in `find $DATAROOT -depth 1 -type d`; do
    32   for DEVICEDIR in `find $USERDIR -depth 1 -type d`; do
     23
     24#Kismet netxml Imports
     25FILES="`find $DATAROOT -name '*netxml*'`"
     26[ -n "$FILES" ] && $MANAGE import_kismet $ARGS $FILES
     27
     28# Import all measure data
     29for USERDIR in `find $DATAROOT -maxdepth 1 -type d`; do
     30  for DEVICEDIR in `find $USERDIR -maxdepth 1 -type d`; do
    3331    USERNAME=`basename $USERDIR`
    3432    DEVICE=`basename $DEVICEDIR`
    3533    ARGS="-g $USERNAME -e $USERNAME@wirelessleiden.nl -k $DEVICE"
    36     # Kismet Imports
    37     for FILE in `find $DEVICEDIR -name 'Kismet*gpsxml*'`; do
    38       $MANAGE import_kismet $ARGS -m `basename $FILE` $FILE
    39     done
    40    
     34
     35    #Kismet gpsxml Imports
     36    FILES="`find $DEVICEDIR -name '*netxml*'` `find $DEVICEDIR -name '*gpsxml*'`"
     37    [ -n "$FILES" ] && $MANAGE import_kismet $ARGS $FILES
     38
    4139    # DroidStumber imports
    42     for FILE in `find $DEVICEDIR -name 'ScanResult-*'`; do
    43       $MANAGE import_droidstumbler $ARGS -m `basename $FILE` $FILE
    44       if [ $? -eq 0 ]; then
    45         ADDED=1
    46       fi
    47     done
     40    FILES=`find $DEVICEDIR -name 'ScanResult-*'`
     41    [ -n "$FILES" ] && $MANAGE import_droidstumbler $ARGS $FILES
    4842  done
    4943done
    5044
    51 if [ "$ADDED" -eq 1 ]; then
     45if [ "$ADDED" -eq 1 -a -r $MAP_CACHE ]; then
    5246  echo "# Clear cache $MAP_CACHE"
    5347  htcacheclean -l10K -p$MAP_CACHE
Note: See TracChangeset for help on using the changeset viewer.