badbadntgood

Members
  • Posts

    8
  • Joined

  • Last visited

About badbadntgood

  • Birthday November 4

Converted

  • Gender
    Male

badbadntgood's Achievements

Noob

Noob (1/14)

0

Reputation

  1. Thank you for the updated version to prevent the pipe errors. Unfortunately i'm now getting an error message saying that my paths are not being used by docker. video_paths=( "/mnt/user/data/media/movies" "/mnt/user/data/media/tv" ) My paths in docker are set as /mnt/user/data/media typically but even changing to exclude the movies and tv subfolder and doing /mnt/user/data/media I get the same error message. Should I just remove the below section? # check if paths are used in docker containers if docker info > /dev/null 2>&1; then # get docker mounts of all running containers # shellcheck disable=SC2016 docker_mounts=$(docker ps -q | xargs docker container inspect -f '{{$id := .Id}}{{range .Mounts}}{{if .Source}}{{printf $id}}:{{.Source}}{{println}}{{end}}{{end}}' | grep -v -e "^$") for path in "${video_paths[@]}"; do if [[ $docker_mounts != *"$path"* ]]; then /usr/local/emhttp/webGui/scripts/notify -i alert -s "Plex Preloader failed!" -d "$path is not used by a docker container!" exit 1 fi done fi
  2. @mgutt Any quick way to resolve this? I'd really like to use this script to optimize my server.
  3. I have them set to /mnt/user/data/media/movies and /mnt/user/data/media/tv it says 950 files can be preloaded and runs for about 15 minutes until it freezes and after inspecting the log is when I get that message #!/bin/bash # ##################################### # Script: Plex Preloader v0.9 # Description: Preloads the recent video files of a specific path into the RAM to bypass HDD spinup latency # Author: Marc Gutt # # Changelog: # 0.9 # - Preloads only subtitle files that belong to preloaded video files # 0.8 # - Bug fix: In some situations video files were skipped instead of preloading them # 0.7 # - Unraid dashboard notification added # - Removed benchmark for subtitle preloading # 0.6 # - multiple video path support # 0.5 # - replaced the word "movie" against "video" as this script can be used for TV Shows as well # - reduced preload_tail_size to 1MB # 0.4 # - precleaning cache is now optional # 0.3 # - the read cache is cleaned before preloading starts # 0.2 # - preloading time is measured # 0.1 # - first release # # ######### Settings ################## video_paths=( "/mnt/user/data/media/movies/" "/mnt/user/data/media/tv/" ) video_min_size="200MB" # 2GB, to exclude bonus content preload_head_size="100MB" # 60MB, raise this value if your video buffers after ~5 seconds preload_tail_size="1MB" # 1MB, should be sufficient even for 4K video_ext='avi|mkv|mov|mp4|mpeg' # https://support.plex.tv/articles/203824396-what-media-formats-are-supported/ sub_ext='srt|smi|ssa|ass|vtt' # https://support.plex.tv/articles/200471133-adding-local-subtitles-to-your-media/#toc-1 free_ram_usage_percent=75 preclean_cache=0 notification=1 # ##################################### # # ######### Script #################### # make script race condition safe if [[ -d "/tmp/${0///}" ]] || ! mkdir "/tmp/${0///}"; then exit 1; fi; trap 'rmdir "/tmp/${0///}"' EXIT; # check user settings video_min_size="${video_min_size//[!0-9.]/}" # float filtering https://stackoverflow.com/a/19724571/318765 video_min_size=$(awk "BEGIN { print $video_min_size*1000000}") # convert MB to Bytes preload_head_size="${preload_head_size//[!0-9.]/}" preload_head_size=$(awk "BEGIN { print $preload_head_size*1000000}") preload_tail_size="${preload_tail_size//[!0-9.]/}" preload_tail_size=$(awk "BEGIN { print $preload_tail_size*1000000}") # clean the read cache if [ "$preclean_cache" = "1" ]; then sync; echo 1 > /proc/sys/vm/drop_caches fi # preload preloaded=0 skipped=0 preload_total_size=$(($preload_head_size + $preload_tail_size)) free_ram=$(free -b | awk '/^Mem:/{print $7}') free_ram=$(($free_ram / 100 * $free_ram_usage_percent)) echo "Available RAM in Bytes: $free_ram" preload_amount=$(($free_ram / $preload_total_size)) echo "Amount of Videos that can be preloaded: $preload_amount" # fetch video files while IFS= read -r -d '' file; do if [[ $preload_amount -le 0 ]]; then break; fi size=$(stat -c%s "$file") if [ "$size" -gt "$video_min_size" ]; then TIMEFORMAT=%R benchmark=$(time ( head -c $preload_head_size "$file" ) 2>&1 1>/dev/null ) echo "Preload $file (${benchmark}s)" if awk 'BEGIN {exit !('$benchmark' >= '0.150')}'; then preloaded=$((preloaded + 1)) else skipped=$((skipped + 1)) fi tail -c $preload_tail_size "$file" > /dev/null preload_amount=$(($preload_amount - 1)) video_path=$(dirname "$file") # fetch subtitle files find "$video_path" -regextype posix-extended -regex ".*\.($sub_ext)" -print0 | while IFS= read -r -d '' file; do echo "Preload $file" cat "$file" >/dev/null done fi done < <(find "${video_paths[@]}" -regextype posix-extended -regex ".*\.($video_ext)" -printf "%T@ %p\n" | sort -nr | cut -f2- -d" " | tr '\n' '\0') # notification if [[ $preloaded -eq 0 ]] && [[ $skipped -eq 0 ]]; then /usr/local/emhttp/webGui/scripts/notify -i alert -s "Plex Preloader failed!" -d "No video file has been preloaded (wrong path?)!" elif [ "$notification" = "1" ]; then /usr/local/emhttp/webGui/scripts/notify -i normal -s "Plex Preloader has finished" -d "$preloaded preloaded (from Disk) / $skipped skipped (already in RAM)" fi
  4. Is there still support for this script? Coming across an error message - tr: write error: Broken pipe tr: write error cut: write error: Broken pipe I have 128GB of RAM installed, and set free ram usage to 75% so I should be able to utilize about 96GB, my dashboard only shows about 9% utilized overall, i'm assuming this error is preventing the script from fully running.
  5. I figured out another way just so it would be limited within the docker container shortly after your reply (of course). I edited the config.json file via unraid CLI to 75 instead of 60. Thank you for the assistance, nonetheless.
  6. Is there any way to set the GPU power usage without the GUI? I set the value to 60 and since restarting the container I'm getting an error message within the logs stating that the value must be higher than 75 but I'm unable to access the GUI to change it. I have attempted --pl 75 through the docker container CLI and the command is not recognized.
  7. Is there a way to have only the block data move to an array while keeping the appdata within cache? I have 500GB of cache but have other uses within unraid for that storage, whereas I have multiple TBs of array storage.