• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support Troubleshooting Autostart of Jellyfin/Jellyfin container

     
    • 0 Vote(s) - 0 Average

    Autostart of Jellyfin/Jellyfin container

    Autostart of Jellyfin/Jellyfin container in my Proxmox Vm not working
    Eisbergsalat
    Offline

    Junior Member

    Posts: 5
    Threads: 1
    Joined: 2024 Jul
    Reputation: 0
    Country:Germany
    #7
    2024-09-29, 01:06 PM
    "Tomorrow" I said Woozy-face

    Hey there, I am back.

    I got in some time management conflicts due to uni exams.
    AND then I got a new router and suddenly I had that DS-lite infection .......  Face-with-head-bandage

    BUT that got sorted out and now I am back to report my status in this problem:

    It works! Smiling-face



    What did I do?

    1. Create an JellyfinStartup.sh:
    Code:
    #!/bin/bash
    # Logger aktivieren:
    exec > >(logger -t JellyfinStartup) 2>&1

    # URL des Servers
    SERVER_URL="http://[IP:Port or URL]/" ###########EDIT###########


    # Funktion zum Überprüfen der Erreichbarkeit des Servers
    check_server() {
        status_code=$(curl -s -o /dev/null -w "%{http_code}" $SERVER_URL)
        if [ "$status_code" -eq 200 ] || [ "$status_code" -eq 302 ]; then
            return 0
        else
            return 1
        fi
    }

    # Funktion zum Überprüfen, ob eine Datei existiert
    file_exists() {
        [ -f "$1" ]
    }


    # Hauptlogik
    if check_server; then
        echo "Server ist erreichbar."
        exit 0
    else
        echo "Server ist nicht erreichbar. Neustart von docker-compose.yaml..."
        docker compose -f /path_to_yaml_file/docker-compose.yml down ###########EDIT###########
        sleep 5

    if ! file_exists "/mnt/[any consistent file inside a mounted drive, that is used by the Jellyfin-container. Be aware, that the folder itself wont work, because the folder of the mounted drive exists, even if it is unmounted!]"; then ###########EDIT###########
            umount /mnt/Medien
            sleep 4
            mount -a
            sleep 1
        fi
        sleep 15
        docker compose -f /path_to_yaml_file/docker-compose.yml up -d ###########EDIT###########
        sleep 60

        if check_server; then
            echo "Server ist erreichbar."
            exit 0
        else
            systemctl daemon-reload
            systemctl restart remote-fs.target
            sleep 60  # 1 Minute warten
            docker compose -f /path_to_yaml_file/docker-compose.yml up -d ###########EDIT###########
            sleep 60
            if check_server; then
                echo "Server ist erreichbar."
                exit 0
            else
                echo "Server ist noch nicht erreichbar. Neustart des Systems..."
                sleep 5
                reboot
                sleep 55
                exit 1
            fi
        fi
    fi

    2. Create an crontab -e entry (as root)
    Code:
    @reboot sleep 300 && /path_to_script/JellyfinStartup.sh


    Info:
    I created this script with the help of copilot. (At least a thousand times I had to express my wishes)

    And this script was created in order to reboot Jellyfin, because the linked mounted drive (in my case SMB) is not available during startup.

    If you need this script, dont forget to edit those lines, where I added " ###########EDIT########### " at the end.
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    Messages In This Thread
    Autostart of Jellyfin/Jellyfin container - by Eisbergsalat - 2024-07-15, 11:24 AM
    RE: Autostart of Jellyfin/Jellyfin container - by TheDreadPirate - 2024-07-15, 05:47 PM
    RE: Autostart of Jellyfin/Jellyfin container - by Eisbergsalat - 2024-07-17, 04:27 PM
    RE: Autostart of Jellyfin/Jellyfin container - by TheDreadPirate - 2024-07-17, 05:28 PM
    RE: Autostart of Jellyfin/Jellyfin container - by Eisbergsalat - 2024-08-15, 06:12 AM
    RE: Autostart of Jellyfin/Jellyfin container - by Eisbergsalat - 2024-08-16, 12:34 PM
    RE: Autostart of Jellyfin/Jellyfin container - by Eisbergsalat - 2024-09-29, 01:06 PM

    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode