INNER CODE UNIT · Python

restart_plex

ahembree/ansible-hms-docker · roles/hmsdocker/files/scripts/traefik_cert_convert.py:164

def restart_plex(compose_project: str) -> None:
    """Restarts the Plex container in the defined Compose project

    Args:
        compose_project (``str``): The Compose project where the Plex container is
    """    
    container = get_container_by_image('lscr.io/linuxserver/plex')
    if container is type(list):
        for con in container:
            if con.labels['com.docker.compose.project'] == compose_project:
                logging.warning(f'Restarting container ID: {con.short_id}')
                con.restart()
    else:
        if container.labels['com.docker.compose.project'] == compose_project:
            logging.warning(f'Restarting container ID: {container.short_id}')
            container.restart()

def get_container_by_image(image: str):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…