Pulvinar tempor cras amet ac turpis tristique tristique ... (read more)close
Pulvinar tempor cras amet ac turpis tristique tristique ... (read more)close

LukeTaylor.org Blog

Making I.T that little bit easier !


by in Linux Blog
  • Font size: Larger Smaller
  • Hits: 6197
  • 1 Comment
  • Subscribe to this entry
  • Print


The purpose of this Blog Entry is to show you how a script can update the IP of your Tracker if your dynamic ip changes ( and you host your own Tracking server , i.e. Traccar)


Most of these cheaper GPRS trackers dont allow you to set the tracking server as a DNS host name. So basically if your IP changes your car wont send the tracking data to your server and you will have to manually update it via TXT . Another possible benefit of this script is it automates a SMS response and your tracker will reply to it ( which means your simcard will have SMS activity and wont expire)


The original script was found HERE , this was aimed I think at the USA market . This script is aimed more at the UK market.

The provider who we will be using to send the free text messages out is http://www.smspi.co.uk/ , Please sign-up for an account.

Please install CURL in your Linux environment

Ok the way this script works is

1.) You install the script as a 5 min cron

2.) Every 5 mins the script checks http://ipecho.net/plain to receive your current outside IP in plain text

3.) it stores the current IP in a file located in Etc/ called .IP-cache

4.) if the IP is still current the script ends .

5.) if the IP has changed the value in .IP-cache the following command is sent to the tracker via TXT/SMSPI.co.uk

curl --data "to=PHONENUMBER&message=adminip123456 $current 5001 &hash=YOURHASHCODE" http://www.smspi.co.uk/send/

 6.) This code sends a text message to your trackers phone number setting the new ip of your tracking server including port etc .


 Plain and simple , i didn't edit much so hats off to "David Wayne Baxter" for creating the base script .

You can get the API HASH from your login via smsip.co.uk


And here is the script you need

# Before using, home directory references must be modified to match invoking user.
# Additionally, run touch on ~/.ip-cache prior to first run to avoid issues.
prev=`/bin/cat $cache`
current=`/usr/bin/wget -qO- http://ipecho.net/plain`
# trap possible wget error
if [ $? != 0 ]; then
   exit 1;
# new IP found
if [ "$current" != "$prev" ]; then

curl --data "to=YOURNUMBER&message=adminip123456 $current 5001 &hash=YOURHASH" http://www.smspi.co.uk/send/
   # SMS was successfully delivered to Google Voice
   # (impossible to determine whether SMS was delivered to phone)
   if [ $? -eq 0 ]; then
      /bin/echo "$current" > "$cache"
      exit 0
   # SMS send failed
      exit 1;
# old IP still present
   exit 0;


Rate this blog entry:


  • Guest
    Florence M. Gravitt Friday, 08 October 2021

    I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy FOR MORE DETAILS.

Leave your comment

Guest Thursday, 21 October 2021