This sets up a cron job that runs every 5 minutes to query a DB and check for any data integrity/inconsistency problems. It keeps track of previous data that was analyzed so that we don't continually get notifications on the same data. This data is stored in current-data.json (if any or if the script has been run the first time).
This was designed on Node 22 and the associated npm version.
To install this on a new server, do the same you'd do for development. So, install the code, then run
npm install
Copy the .env.example file and rename it to .env and set the properties.
Do the following:
- In
/lib/systemd/system/data-integrity-alerter.service, create thedata-integrity-alerter.serviceand populate it with the same contents as that file in this repository. - Reload the daemon by
sudo systemctl daemon-reload. - Ensure SystemD will automatically start the service by running
sudo systemctl enable data-integrity-alerter. - Start the service
sudo systemctl start data-integrity-alerter. - (Optional) Check the service status
sudo systemctl status data-integrity-alerter.