Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # phonetracker.sh by Martin Loewe
- # Put your nextcloud server url in here
- URL="https://example.com/nextcloud"
- # Put your Session ID in here
- SESSION="1234567890abcdef"
- # Put your device name in here
- NAME="Tracked Phone"
- # Put your update delay in here in seconds
- DELAY=20
- while :
- do
- FIX=$(/usr/sbin/gpsctl -s) # get GPS fix status
- if [ "$FIX" = "1" ] # check if GPS fix is ok
- then
- LAT=$(/usr/sbin/gpsctl -i) # get latitude
- if [ "$LAT" != "$LATOLD" ] # check if new latitude is different to old latitude
- then
- LATOLD=$LAT # set old latitude to new one
- SPD=$(/usr/sbin/gpsctl -v) # get ground speed
- LON=$(/usr/sbin/gpsctl -x) # get longitude
- SAT=$(/usr/sbin/gpsctl -p) # get connected sattelites
- ALT=$(/usr/sbin/gpsctl -a) # get altitude
- ACC=$(/usr/sbin/gpsctl -u) # get accuracy
- TIMESTAMP=$(/usr/sbin/gpsctl -t) # get gps timestamp
- curl "$URL/index.php/apps/phonetrack/log/gpslogger/$SESSION/$NAME?lat=$LAT&lon=$LON&sat=$SAT&alt=$ALT&acc=$ACC&speed=$SPD×tamp=$TIMESTAMP" # send data to nextcloud
- fi
- fi
- sleep $DELAY
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement