def rotate(paths, name, deploy=False, generic=False, verbose=False, **params):
lgr.setLevel(logging.DEBUG if verbose else logging.INFO)
if generic:
params = _generate_generic_config(params)
if deploy and not find_executable('logrotate'):
lgr.error('logrotate was not found on this system. aborting deploy.')
sys.exit(1)
params.update(dict(paths=paths, name=name))
logrotate_config_path = _generate_tmp_file_path(name)
lgr.info('Generating logrotate config...')
_generate_from_template(logrotate_config_path, **params)
if deploy:
logrotate_destination_path = os.path.join(LOGROTATED_PATH, name)
_deploy_logrotate_config(
logrotate_config_path,
logrotate_destination_path)
评论列表
文章目录