📝 ISE_data_integrity_manual.mdv4.7.5 · 2026-12-05

ISE_data_integrity — Manual

Package ISE_data_integrity v1.0.0
Date 2026-12-02
System Live only
Authors Andrew.human & Claude.ai

Purpose

This is an hourly, read-only health check of the ISE stores in /var/www/html/ISE_Data. It answers two questions:

  1. Does every store still load as valid JSON? A cut-off or overlapping write, such as two indexing jobs running at once, makes a store unreadable.
  2. What shape is each post, PDF and misc store, how many entries does each hold, and what does the processor checkpoint say?

It never changes, moves, repairs or deletes anything.

Files

File Install to What it does
ISE_data_integrity.sh /bin/ Cron entry point. Prints its version and the date and time, then runs the two scripts below.
json_integrity1.sh /bin/ Loads every *.json at the ISE_Data root and prints OK <file> or BAD <file>.
json_integrity2.sh /bin/ For post_store.json, pdf_store.json and misc_store.json, prints whether the store is a dict or a list, its entry count and its first keys. Then prints the first 400 characters of processor_checkpoint.json.
ISE_data_integrity_manual.md wherever you keep manuals This file.

All three scripts need mode 755.

Install

cp ISE_data_integrity.sh json_integrity1.sh json_integrity2.sh /bin/
chmod 755 /bin/ISE_data_integrity.sh /bin/json_integrity1.sh /bin/json_integrity2.sh

Add this crontab entry for root with crontab -e:

37 * * * * /bin/ISE_data_integrity.sh >> /var/log/ISE_data_integrity.log 2>&1

Minute 37 is chosen to stay away from jobs that start on the hour. If an indexer such as MediaIndexer writes to ISE_Data near :37, move the check to a minute when nothing else writes. A check that runs while a store is being written can show a false BAD.

Reading the log

Each hourly run looks like this:

ISE_data_integrity.sh v1.0.0  2026-12-02 05:58:59 UTC
json_integrity1.sh v1.0.0
OK misc_store.json
...
json_integrity2.sh v1.0.0
post_store.json dict 2 ['101', '102'] dict
pdf_store.json list 2 ['id_attach', 'name']
misc_store.json dict 1 ['9'] dict
checkpoint: {"last_id": 102, "stage": "done"}

Useful one-liners:

grep -c '^BAD' /var/log/ISE_data_integrity.log
awk '/^ISE_data_integrity.sh v/{h=$0} /^BAD/{print h" -> "$0}' /var/log/ISE_data_integrity.log

The first counts BAD lines ever logged. The second lists each BAD line with the date and time of its run.

Behaviour rules

  1. The scripts are read-only. Nothing in ISE_Data or anywhere else is ever written, apart from the log that cron appends to.
  2. Each script prints its version once, as its first line.
  3. The combined script also prints the date and time on its version line, so every run in the log can be told apart.
  4. Each script works from /var/www/html/ISE_Data whatever folder it is started from. If that folder can't be entered, the script prints an error and exits with code 1.
  5. Each script adds /usr/local/bin to its search path so that python3 is found under cron. If python3 still can't be found, the script prints an error and exits with code 1 without reporting on any store.
  6. json_integrity1.sh checks every *.json at the ISE_Data root and never looks in subfolders.
  7. json_integrity2.sh reports on exactly four files: post_store.json, pdf_store.json, misc_store.json and processor_checkpoint.json.

Pseudocode (v1.0.0)

ISE_data_integrity.sh
print "ISE_data_integrity.sh v<ver> <date time zone>"
run /bin/json_integrity1.sh
run /bin/json_integrity2.sh
print blank line

json_integrity1.sh
print "json_integrity1.sh v<ver>"
add /usr/local/bin to PATH
cd /var/www/html/ISE_Data else print error, exit 1
python3 findable? else print error, exit 1
for each *.json:
loads as JSON? print "OK <file>" else print "BAD <file>"

json_integrity2.sh
print "json_integrity2.sh v<ver>"
add /usr/local/bin to PATH
cd /var/www/html/ISE_Data else print error, exit 1
python3 findable? else print error, exit 1
for post_store, pdf_store, misc_store:
dict -> print name, "dict", count, first 3 keys, type of first value
list -> print name, "list", count, first 8 field names of first entry
print "checkpoint:" + first 400 chars of processor_checkpoint.json

Version history

Version Date Change
1.0.0 2026-12-02 First release. Built from Andrew's valid-JSON one-liner (json_integrity1) and the store-shape probe (json_integrity2), combined for an hourly cron job on Live.