Commit to the database periodically when running sqlite
First pass at an API to let another program control main()