Updated new version (now with td-agent restart)