Dump1090 MySQL Database Script with Alert and Filter

please answer above questions!
stabbing in the dark - maybe works:

Thank you. That was it.

I’m sure for a more experienced user this might be easier, but for me there
were great gaps in the instructions, including what to do with the files
now in my home directory.

Anyway, problem solved and I’m looking forward to using it.

All the best,
Geoff in California

hi geoff - fine that the problem is solved :slight_smile:

you find this and many other questions already answered in those threads:

kind regards
tom (munich/bavaria)

added a short howto in top post to setup a system service instead of using cron. this way it’s more convenient to start/stop/enable/disable and see status of script: Dump1090 MySQL Database Script with Alert and Filter

Hi @TomMuc ,

First of all thanks for such a great little script!

I may have missed something in the instructions, however I am wondering if it is possible to set the script up to alert when an aircraft first becomes visible, then not again until the aircraft has not been visible for a set length of time? This would make tracking when our local air ambulance takes off a lot easier.

Many Thanks


hi benjamin,

i’m not sure if i really understood what you want to achieve?

the timing you setup in $user_set_array[‘aircraft_suspend_time’] = 300 are the seconds from first alert until this aircraft is able to trigger the next alert. alert conditions are determined with lat/lon/alt and/or a given flight/transponder. so if you e.g. want to track takeoff/landing of your local air ambulance(s) the best way i see is to use the transponder-code(s) and write it/them into _hex_code_array.txt and setup and area and altitude some miles around the airfield. this way you would get alert-messages as soon as the ambulance takes-off or lands.


p.s. to avoid alerts from other aircrafts that may use the same airfield you can set $user_set_array[‘filter_mode_alert_limited’] = false to true

p.p.s. if you additinally want to track and save the whole flightdata over the range your site gets messages of the ambulance to a database you could simply run a second instance of the script with little different setup …

I have set up the aircraft_suspend_time and hex_code_array.txt etc. and am receiving alerts. However, the alert only seems to be sent to Pushover after the aircraft has been visible for some time, not immediately (the delay seems to be the aircraft_suspend_time).

hmmm - what suspend time did you use? did you setup one ore more hex-codes? what does the alert message say - is the lat/lon marker you get near the airfield, what altitude, what timestamp?

edit: if anything is setup the right way and the script works as intended - you should get the first alert message within some seconds after the first time alert condition was met. the suspend time has no influence on the first alert message for an particular aircraft

edit2: if you struggle with the setup - send me a pm and i’ll give you my email - then you could send me your files and the airfield lat/lon + hex codes and i try to set it up for you

Hello Tom,

What is my username? When I run radar.php, this repeats:
“pi@piaware:~$ php radar.php
upt(us): 0011005 - 1.000000 loops/s avg - since 0 days 00:00:00 - run 0 @ 0,0 msg/s → 000 dataset(s) => db-error
SQLSTATE[28000] [1045] Access denied for user ‘USERNAME’@‘localhost’ (using password: YES)”

I didn’t have any luck with this install TomMuc. When I enter :

sudo systemctl status radar.service

I get:

● radar.service - radar.php
Loaded: loaded (/etc/systemd/system/radar.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sun 2018-05-20 13:58:08 AEST; 4s ago
Process: 3268 ExecStart=/home/opi/radar.php (code=exited, status=255)
Main PID: 3268 (code=exited, status=255)

May 20 13:58:08 orangepipcplus systemd[1]: radar.service: Unit entered failed state.
May 20 13:58:08 orangepipcplus systemd[1]: radar.service: Failed with result ‘exit-code’.

Keeping in mind my path is ‘opt’ and not ‘pi’ I made an adjustment to the script:




if you are not able to setup a proper service on your linux/unix just use a cronjob to auto-run the script. howto you find in those threads here and on github.

I have manag3d to overcome that problem TomMuc. I got to the data base setup. This is what I am getting:

SQLSTATE[HY000] [1045] Access denied for user ‘opi’@‘localhost’ (using password: YES)
upt(us): 0007420 - 1.000000 loops/s avg - since 0 days 00:00:23 - run 23 @ 0,0 msg/s → 000 dataset(s) => db-er

I have a set a password in the top of radar.php???

I am a newbie…

Is installing sendmail necessary for the email functionality to work? I ask this because Joe:

scripts install something else (procmail?), and after sendmail installed itself all my ADSB stuff stopped working. I had remove and rerun the installation script included with that build.

adding this part later:
Now several services would not start. There was a message about org.freedesktop not being registered as something or other which I tracked down to the need to install polkit-1, which resulted in this:

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start ‘lighttpd.service’.
Authenticating as: root

How di I get around this issue? And then how can I get this alert installed without wrecking everything again?


Yes, there is a line that has the password you chose for the adsb database about halfway down the declarations.

I’m sorry, lighttpd service trying to start as root = adsb database login attempt?
I dont remember being prompted for anything but maybe something went wrong.

I uninstalled all the packages but is there a way to reverse everything else and start over? Or do I need to reimage and try again?

I gave up and reimaged with Joe’s latest build…

First off, huge thank you to TomMuc for coming up with this script.

I have noticed the latest update of piaware and dump1090 breaks a few things. I have gone ahead and modified things on my end and got things working again. A few variables have changed. For example, “speed” is now “gs” or ground speed. I can post the changes I made to radar.php if anyone is interested.

1 Like


cool - i did’t know about this :slight_smile: are you on github? if so you could open a case and tell me whats new or needed. if you don’t have a github account just write here in the forum what you discovered and i’ll update the scripts on github.


could it be that with the last piaware image radar.php config needs to be changed.
with http://<>/dump1090-fa/data/ I am not able to get some data to be parsed by your script??

the only directory where a aircraft.json is available is /run/dump1090-fa/
the ../html/data directory does not exist?


<> should be the ip address of the computer running dump1090
Or just localhost if it’s running on the same computer.