Changeset 9555


Ignore:
Timestamp:
Aug 24, 2011, 8:44:15 PM (13 years ago)
Author:
rick
Message:

Quick and dirty full_import

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/import_scan_data.sh

    r9552 r9555  
    33# Quick and dirty hack to import all data
    44
     5if [ `id -un` != "www" ]; then
     6  echo "ERROR, run as www user: sudo -E -u www $0"
     7  exit 1
     8fi
    59
    6 DATAROOT="$HOME/scan-data"
    7 MANAGE="$HOME/django_gheat/manage.py"
     10DATAROOT="/usr/local/var/scan-data"
     11MAP_CACHE=/usr/local/var/httpd/cache/maps
     12MANAGE="`dirname $0`/manage.py"
     13SSH_USER=backup
     14SSH_KEY="`dirname $0`/id_rsa"
     15export PYTHON_EGG_CACHE=/tmp/
    816
    917echo "# rsync webfolder"
    10 rsync -az rvdzwet@tyan.wirelessleiden.nl:/usr/local/www/webfolder/scan-data/ $DATAROOT
     18rsync -e "ssh -i $SSH_KEY -l $SSH_USER -o StrictHostKeyChecking=no" -az tyan.wirelessleiden.nl:/usr/local/www/webfolder/scan-data/ $DATAROOT || exit 1
     19
    1120
    1221echo "# unzip compressed .tar.gz files"
     
    1827done
    1928
     29ADDED=0
    2030# Import all data
    2131for USERDIR in `find $DATAROOT -depth 1 -type d`; do
     
    3242    for FILE in `find $DEVICEDIR -name 'ScanResult-*'`; do
    3343      $MANAGE import_droidstumbler $ARGS -m `basename $FILE` $FILE
     44      if [ $? -eq 0 ]; then
     45        ADDED=1
     46      fi
    3447    done
    3548  done
    3649done
    3750
    38 # Clear cache
    39 sudo -u www htcacheclean -l10K -p/usr/local/var/apache/cache/maps
     51if [ "$ADDED" -eq 1 ]; then
     52  echo "# Clear cache $MAP_CACHE"
     53  htcacheclean -l10K -p$MAP_CACHE
     54fi
    4055
Note: See TracChangeset for help on using the changeset viewer.