Make the local script directory configurable

Change-Id: Ia446f2e25748725ce4b64a3a654b4e50da672944
Use MySQL

And some other minor changes gleaned from production testing.

Remove the scripts dir because it is no longer needed.

Change-Id: I7ffe3ed8d2a1be294637ac18bc3eaefede97d401