Created
March 31, 2021 17:21
-
-
Save JuanM04/f531d3faeb000f6dd0512614d64540dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/zsh | |
TIMEOUT=2h | |
SERVER_URL=192.168.86.4 | |
function stop_server { | |
docker stop media_server > /dev/null | |
} | |
trap "stop_server && exit 0" SIGINT | |
if [ $# -eq 1 ]; then | |
TIMEOUT="$1" | |
fi | |
docker run \ | |
-d --rm \ | |
-e "JELLYFIN_PublishedServerUrl=http://$SERVER_URL" \ | |
-e "NVIDIA_VISIBLE_DEVICES=all" \ | |
--network host \ | |
-v "$(pwd)/config:/config" \ | |
-v "$(pwd)/cache:/cache" \ | |
-v "$(pwd)/media:/media" \ | |
--name media_server \ | |
jellyfin/jellyfin > /dev/null | |
echo "Power off in $TIMEOUT" | |
sleep "$TIMEOUT" & | |
wait $! | |
stop_server | |
echo "Shutting down..." | |
shutdown now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment