Skip to content

Instantly share code, notes, and snippets.

# what is this? performs the steps outlined in Plex's garbage instructions on how to "Manually Repair the Database"
# notes
# although this script will backup your Plex DB, i would suggest making your own backup.
# this script assumes you are comfortable with copying/pasting/running random things from the internet.
# this script assumes a DOCKER ENVIRONMENT (unRAID and Plex docker). modify accordingly to suit your needs.
# what is this? query your Radarr library and make changes via the API.
# in this example we query all Radarr entries, identify movies that are named (movie title), THE (year) and update the .path and .folderName to (THE movie title) (year)
# after updating Radarr, rename the folders on the filesystem;
# what is this? identify movies that are named (movie title), THE (year) and rename to (THE movie title) (year)
targetDirectories=$(find . -maxdepth 1 -type d -regextype "posix-extended" -regex '.*\,\s(The|the)\s.*' -print | cut -d/ -f 2)
for dir in $targetDirectories; do
# what is this? poll your UPS using "upsc" and store values using InfluxDB for use with Grafana
# unRAID UPS plugin;
# unRAID CA User Scripts; plugin
# unRAID User Scripts; add script, custom schedule = */1 * * * *
command="upsc ups"
# credit;
# note: the path to the script must be accessible from within the docker shell
# option 1) run from inside the docker shell (do this first to make sure it works)
# option 2) run-as unraid user-script scheduled on-first-array-start-only (run once in background to avoid unraid reboot)
# nohup docker events --filter "container=plex" | awk '/container start/ { system("docker exec -i plex /bin/bash -c '/media/scripts/docker-plexencode/script'") }' &
scrathe / Plex nvdec
Created Mar 16, 2019 — forked from Xaero252/
Enable nvdec support for plex dockers on unraid
View Plex nvdec
# This should always return the name of the docker container running plex - assuming a single plex docker on the system.
con="$(docker ps --format "{{.Names}}" | grep -i plex)"
echo -n "<b>Applying hardware decode patch... </b>"
# Check to see if Plex Transcoder2 Exists first.
exists=$(docker exec -i "$con" stat "/usr/lib/plexmediaserver/Plex Transcoder2" >/dev/null 2>&1; echo $?)
scrathe /
Last active Apr 1, 2018
PeerGuardian Linux (pgl) whitelist cronjob
# cronjob to monitor domains for IP changes, and add them to PeerGuardian Linux (pgl) whitelist
# sudo crontab -e
# W="list of domains to be whitelisted"
*/30 * * * * W="" ; for H in $W ; do for H_IP in `dig $H A +short | grep -P "^\d.*"` ; do echo "${H}:${H_IP}-" | tee -a '/etc/pgl/allow.txt' ; done ; done && sort /etc/pgl/allow.txt | uniq > /etc/pgl/allow.p2p && service pgl reload