Static Sensor Site

I wrote a small perl script to rebuild a federated wiki site from scratch every five minutes.

The script read from flat files already aggregated on the publicly available c2.com.

The script ran as a cron job. Since it read one place and wrote in another, it wasn't as scary to work on as some cron jobs can be.

The script interpolated data into literal strings that happened to be the skeleton json for the static site.

We generate the following reports from flat files maintained within the SensorServer system with the mksensor script.

As I've come to understand the value of a good create action in a page's journal, I went back and modified the script to include these in the static pages.

sub page { my ($slug,$title,$story) = @_; my $date = `date +%s`; $date =~ s/\n/000/; my $action = <<; {"date": $date, "id": "c4737b88db772aaa", "type": "create", "item": {"title": "$title", "story": $story}} open F, ">$slug.json"; print F <<; {"title": "$title", "story": $story, "journal": [$action]} }

Notice $story appears twice: once in the page and again in the action. Should this page cast about in the federation, one story is free to evolve, the other is frozen as it was at the time of creation.