added log rotation options; separated logic to do_cmd_now_on_s3