Changeset 9564
- Timestamp:
- Aug 25, 2011, 1:26:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/import_scan_data.sh
r9555 r9564 3 3 # Quick and dirty hack to import all data 4 4 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 5 DATAROOT=${1:-"`pwd $0`/scan-data"} 6 MAP_CACHE=${MAP_CACHE:-"/usr/local/var/httpd/cache/maps"} 12 7 MANAGE="`dirname $0`/manage.py" 13 8 SSH_USER=backup … … 16 11 17 12 echo "# 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 113 rsync -e "ssh -i $SSH_KEY -l $SSH_USER -o StrictHostKeyChecking=no" -az tyan.wirelessleiden.nl:/usr/local/www/webfolder/scan-data/ $DATAROOT 19 14 20 15 … … 22 17 for FILE in `find $DATAROOT -name '*.tar.gz'`; do 23 18 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 27 20 done 28 21 29 22 ADDED=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 25 FILES="`find $DATAROOT -name '*netxml*'`" 26 [ -n "$FILES" ] && $MANAGE import_kismet $ARGS $FILES 27 28 # Import all measure data 29 for USERDIR in `find $DATAROOT -maxdepth 1 -type d`; do 30 for DEVICEDIR in `find $USERDIR -maxdepth 1 -type d`; do 33 31 USERNAME=`basename $USERDIR` 34 32 DEVICE=`basename $DEVICEDIR` 35 33 ARGS="-g $USERNAME -e $USERNAME@wirelessleiden.nl -k $DEVICE" 36 # Kismet Imports 37 for FILE in `find $DEVICEDIR -name 'Kismet*gpsxml*'`; do38 $MANAGE import_kismet $ARGS -m `basename $FILE` $FILE39 done40 34 35 #Kismet gpsxml Imports 36 FILES="`find $DEVICEDIR -name '*netxml*'` `find $DEVICEDIR -name '*gpsxml*'`" 37 [ -n "$FILES" ] && $MANAGE import_kismet $ARGS $FILES 38 41 39 # 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 48 42 done 49 43 done 50 44 51 if [ "$ADDED" -eq 1 ]; then45 if [ "$ADDED" -eq 1 -a -r $MAP_CACHE ]; then 52 46 echo "# Clear cache $MAP_CACHE" 53 47 htcacheclean -l10K -p$MAP_CACHE
Note:
See TracChangeset
for help on using the changeset viewer.