WIP: make script configurable, and runnable without monitoring

This PR is opened just to show y'all where I'm going with this script, and to solicit feedback / ideas.  I recommend you pull it down and view it in an editor that does BASH syntax highlighting; I personally find it hard to read in GitHub when such large blocks are changed.  Don't bother looking at the NUMPY section or anything after it, as I haven't fixed those parts yet.