Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25
  1. Ikyo's Avatar
    Posts
    290 Posts
    Global Posts
    292 Global Posts
       #21  
    I have the MySQL server up and running on one of my machines. I am working on the script to send the data over to the server now. I might have something simple working later on today.
  2. #22  
    Quote Originally Posted by Ikyo View Post
    I have the MySQL server up and running on one of my machines. I am working on the script to send the data over to the server now. I might have something simple working later on today.
    Patiently waiting
  3. Ikyo's Avatar
    Posts
    290 Posts
    Global Posts
    292 Global Posts
       #23  
    If you are wanting to use this, make sure to have mysql and crond installed on your Pre.
  4. Ikyo's Avatar
    Posts
    290 Posts
    Global Posts
    292 Global Posts
       #24  
    Here is the code for the remote MySQL Database along with the database layout:

    Code:
    #!/bin/sh
    HOST=[HOST NAME]
    USR=[User for Database & Log]
    PWD=[Database Password]
    
    pos=$(/home/scripts/luna-send -n 3 palm://com.palm.location/startTracking '{"appId": "ILovePalm", "subscribe": true}' 2>&1 | tail -1)
    pos=$(echo $pos | sed -r 's/[^-\.0-9,]//g')
       
    lat=$(echo $pos | cut -d, -f4)
    lon=$(echo $pos | cut -d, -f5)
    hed=$(echo $pos | cut -d, -f7)
    spd=$(echo $pos | cut -d, -f8)
    alt=$(echo $pos | cut -d, -f9)
    bat=$(grep BATTERY: /var/log/messages | tail -1 | awk '{print $8}' | sed 's/%,//')
    now=$(date)
    
    query=$(echo "mysql -u $USR -h $HOST --password='$PWD' -e 'use gps;INSERT INTO TrackingData(Lat,Lon,Speed,Heading,Altitude,PreUser) VALUES ($lat,$lon,$spd,$hed,$alt,\"$USR\")'")
    
    echo $query > /tmp/gps.sql
    sh /tmp/gps.sql
    rm -Rf /tmp/gps.sql
    
    exit
    If you are wondering why I am using a special Luna-send, that is because this was designed around being used with the webserver that runs as the user NOBODY. Luna-Send must be run as root. I copied the file and setuid the file to root.

    Here is the database information (server time stamps the information)

    Code:
    CREATE TABLE `TrackingData` (
      `Lat` varchar(24) NOT NULL,
      `Lon` varchar(24) NOT NULL,
      `Speed` int(18) NOT NULL,
      `Heading` int(18) NOT NULL,
      `Altitude` int(18) NOT NULL,
      `PreUser` varchar(24) NOT NULL,
      `Date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1
  5. Ikyo's Avatar
    Posts
    290 Posts
    Global Posts
    292 Global Posts
       #25  
    I did some quick digging and you could do something with the Google Maps API to plot all of the points. If someone is familiar with this, let me know. I will be more then happy to work with you on this.
Page 2 of 2 FirstFirst 12

Posting Permissions