HI,
I need to send SMS with GPS coordinates within a shell script.
Which command(s) do I need to use to send this SMS?
BTW: is it possible to send a email with the GPS coordinates at all?
Thanks a lot!
HI,
I need to send SMS with GPS coordinates within a shell script.
Which command(s) do I need to use to send this SMS?
BTW: is it possible to send a email with the GPS coordinates at all?
Thanks a lot!
Hi,
ist there no way to accomplish this?
Thanks
/Mav
@Mav63
Here’s simple script to send sms
#!/bin/sh
lat=$(gpsctl -i) #get latitude
long=$(gpsctl -x ) #get longitude
gsmsctl -S -s "+3700000000 lat $lat long $long" # sms sending
Hello,
Thank you for getting in touch. I’ve developed a customized script for transmitting GPS coordinates via SMS.
To send emails, you can refer to the information provided in this link: Sending emails via command line - Teltonika Networks Wiki
Connect the device: Connect to your device using Putty.
Open the script file using the vi-text editor.
vi /sbin/gps.sh
#!/bin/sh
# Get latitude
LATITUDE=$(gpsctl -i)
# Get longitude
LONGITUDE=$(gpsctl -x)
# Check if both latitude and longitude are available
if [ -n "$LATITUDE" ] && [ -n "$LONGITUDE" ]; then
# Your logic to handle the GPS coordinates
GPS_COORDINATES="$LATITUDE,$LONGITUDE"
# Create a Google Maps link
MAPS_LINK="https://www.google.com/maps?q=$GPS_COORDINATES"
# Add your SMS sending logic here
# For example, using gsmctl
gsmctl -S -s "+97156xxxxx GPS Coordinates: $GPS_COORDINATES. Location: $MAPS_LINK"
else
echo "Error: GPS coordinates not available."
fi
Save the File: After editing the script, save the changes and exit the text editor.
In vi, press Esc, then type:wq and press Enter.
Make the Script Executable: Ensure the script is executable by running the following command.
chmod +x /sbin/gps.sh
./sbin/gps.sh
Test Result:
Thanks,
Mahmoud
Hi,
thank you both !
This works like charm!
It helped me a lot.
I need to that to send the coordinates periodically. Not every time on every day but on request.
As an example: If I leave my camper I like to switch on the periodic sms send script and as soon as I come back Iike to switch it off.
Of course the periodic send will be accomplished by a crontab entry.
For the switch (on/off) I would wish a possibility on the UI or/and better within the iOS App.
Is there such a possibility?
Thanks a lot for your support!
/Mav
Hello,
If you don’t require a script, you have the option to directly send an SMS to the SIM number within the router. The router will then provide the GPS coordinates in response.
Router-Password gps
Thanks,
Hi Mahmoud,
thanks for your reply.
My problem is, that the ‘primary’ SIM are a Multisim of my main phone SIM. This SIM doesn’t accept SMS. Therefore I use a second SIM (for SMS only - without any data amount) which I periodically switch to primary and then send the mentioned SMS with the coordinates. After that I switch again to the first SIM to proceed with data. I use a RUTX50 which do not use both SIMs in parallel… unfortunately.
Based on this, I like to use a switch, which enable the periodic trigger of that script until it is switched off again. (Default on startup should be: Switched on).
Thanks for your support
/Mav
This topic was automatically closed after 15 days. New replies are no longer allowed.