rewrite log to be bash based, python eats about 4m of memory