2024-09-29, 01:06 PM
"Tomorrow" I said
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 .......
BUT that got sorted out and now I am back to report my status in this problem:
It works!
What did I do?
1. Create an JellyfinStartup.sh:
2. Create an crontab -e entry (as root)
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.
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 .......
BUT that got sorted out and now I am back to report my status in this problem:
It works!
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.