Changeset 9630


Ignore:
Timestamp:
Aug 30, 2011, 6:59:25 PM (13 years ago)
Author:
rick
Message:

Make the import data script more robust.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/import_scan_data.sh

    r9623 r9630  
    66MAP_CACHE=${MAP_CACHE:-"/usr/local/var/httpd/cache/maps"}
    77MANAGE="`dirname $0`/manage.py"
    8 SSH_USER=backup
     8SSH_USER=${SSH_USER:-$USER}
    99SSH_KEY="`dirname $0`/id_rsa"
    1010export PYTHON_EGG_CACHE=/tmp/
    1111
     12DATAROOT_CHOICES="`pwd $0`/scan-data /usr/local/scan-data"
     13if [ "$1" ]; then
     14  DATAROOT=$1
     15else
     16  for D in $DATAROOT_CHOICES; do
     17    if [ -d $D ]; then
     18      DATAROOT=$D
     19    fi
     20  done
     21fi
     22echo "# DATAROOT: $DATAROOT"
     23echo "# SSH_USER: $SSH_USER"
     24
    1225echo "# rsync webfolder"
    13 rsync -e "ssh -i $SSH_KEY -l $SSH_USER -o StrictHostKeyChecking=no" -az tyan.wirelessleiden.nl:/usr/local/www/webfolder/scan-data/ $DATAROOT
     26if [ -r "$SSH_KEY" ]; then
     27  SSH_KEY_OPT='-i $SSH_KEY'
     28else
     29  echo "# warning automatic ssh key $SSH_KEY not readable"
     30  SSH_KEY_OPT=''
     31fi
     32rsync -az -e "ssh $SSH_KEY_OPT -l $SSH_USER -o StrictHostKeyChecking=no" tyan.wirelessleiden.nl:/usr/local/www/webfolder/scan-data/ $DATAROOT
    1433
    1534
     
    2241#Kismet netxml Imports
    2342FILES="`find $DATAROOT -name '*netxml*' | sort`"
    24 [ -n "$FILES" ] && $MANAGE import_common $ARGS $FILES
     43[ -n "$FILES" ] && $MANAGE import_datafile $ARGS $FILES
    2544
    2645# Import all measure data
Note: See TracChangeset for help on using the changeset viewer.