created transcode manager
This commit is contained in:
+61
-39
@@ -36,6 +36,9 @@
|
||||
# MEDIA PERMISSIONS Share list, mode and owner for permissions script
|
||||
# MEDIA CLEANER Anime and media folder lists and file patterns
|
||||
#
|
||||
# ── TRANSCODES ─────────────────────────────────────────────────────────────────────────────
|
||||
# TRANSCODE MANAGER Ramdisk and SSD fallback transcode management
|
||||
#
|
||||
# ── SYSTEM WATCHDOG ────────────────────────────────────────────────────────────────────────
|
||||
# SYSTEM WATCHDOG System health monitoring — last line of defense
|
||||
#
|
||||
@@ -90,7 +93,6 @@
|
||||
# ━━━ Daily Sync Shares ━━━
|
||||
# Shares synced once daily by Orchestrators/daily_sync.sh
|
||||
# No profile needed — all fall through to DEFAULT_RSYNC_OPTS above.
|
||||
# Add or remove paths here to manage what gets synced.
|
||||
DAILY_SYNC_SHARES=(
|
||||
/mnt/user/Anime_Movies-Old
|
||||
/mnt/user/Anime_Shows-Old
|
||||
@@ -227,6 +229,7 @@ WEEKLY_RESTART_CONTAINERS=(
|
||||
# 8GB=8192 6GB=6144 4GB=4096 2GB=2048 1GB=1024
|
||||
declare -A WATCHDOG_CONTAINERS=(
|
||||
["Emby"]=16384
|
||||
["jellyfin_with_request"]=12288
|
||||
["LidaTube"]=6144
|
||||
["Tdarr"]=6144
|
||||
["Code-Server"]=1024
|
||||
@@ -235,6 +238,7 @@ declare -A WATCHDOG_CONTAINERS=(
|
||||
# Containers to check HTTP responsiveness — omit to skip
|
||||
declare -A WATCHDOG_CONTAINER_URLS=(
|
||||
["Emby"]="http://localhost:8096"
|
||||
["Jellyfin-Gmer4Lfe"]="http://localhost:8095"
|
||||
)
|
||||
|
||||
# Containers that should always be running — monitored for unexpected stops
|
||||
@@ -250,7 +254,7 @@ WATCHDOG_REQUIRED_CONTAINERS=(
|
||||
|
||||
# CPU thresholds — normalised against total core count at runtime
|
||||
SOFT_CPU_THRESHOLD=80 # warn at this % of total system CPU
|
||||
HARD_CPU_THRESHOLD=90 # strike at this % of total system CPU
|
||||
HARD_CPU_THRESHOLD=85 # strike at this % of total system CPU
|
||||
CPU_FAIL_LIMIT=2 # consecutive strikes before restart
|
||||
|
||||
# Memory threshold
|
||||
@@ -265,24 +269,19 @@ WATCHDOG_REQUIRED_CONTAINERS=(
|
||||
# ==============================================================================================
|
||||
|
||||
# ━━━ Reboot ━━━
|
||||
# User warning delay before scheduled reboot (seconds)
|
||||
REBOOT_SLEEP=300
|
||||
REBOOT_SLEEP=300 # user warning delay before scheduled reboot (seconds)
|
||||
|
||||
# ━━━ Mover ━━━
|
||||
# Timeout before stopping the mover (seconds)
|
||||
MOVER_STOP_TIMEOUT=300
|
||||
MOVER_STOP_TIMEOUT=300 # timeout before stopping the mover (seconds)
|
||||
|
||||
# ━━━ Syslog Filter ━━━
|
||||
# Path for the rsyslog Docker noise filter file
|
||||
FILTER_FILE="/etc/rsyslog.d/ignore-docker-veth.conf"
|
||||
|
||||
# ━━━ PHP-FPM ━━━
|
||||
# PHP-FPM config file path and max children value
|
||||
PHP_CONF="/etc/php-fpm.d/www.conf"
|
||||
PHP_MAX_CHILDREN=250
|
||||
|
||||
# ━━━ Clear Logs ━━━
|
||||
# System log files to clear on each run
|
||||
LOG_FILES=(/var/log/syslog /var/log/messages /var/log/dmesg)
|
||||
|
||||
# ==============================================================================================
|
||||
@@ -290,7 +289,6 @@ WATCHDOG_REQUIRED_CONTAINERS=(
|
||||
# ==============================================================================================
|
||||
|
||||
# ━━━ Media Permissions ━━━
|
||||
# Mode and owner applied recursively to all listed shares
|
||||
PERMISSIONS_MODE="777"
|
||||
PERMISSIONS_OWNER="nobody:users"
|
||||
|
||||
@@ -340,7 +338,6 @@ MEDIA_CLEAN_FOLDERS=(
|
||||
/mnt/user/Tv_Shows
|
||||
)
|
||||
|
||||
# Anime file patterns — junk files common in anime downloads
|
||||
ANIME_FILE_PATTERNS=(
|
||||
'*.sfv' '*.md5' '*.sha1' '*.txt' '*.url' '*.lnk'
|
||||
'*.rar' '*.zip' '*.info' '*.torrent' '*.sample*' '*.proof*'
|
||||
@@ -348,7 +345,6 @@ ANIME_FILE_PATTERNS=(
|
||||
'*.log' '*.json'
|
||||
)
|
||||
|
||||
# Media file patterns — includes *.iso and *.lrc not needed in anime
|
||||
MEDIA_FILE_PATTERNS=(
|
||||
'*.sfv' '*.md5' '*.sha1' '*.txt' '*.url' '*.lnk'
|
||||
'*.rar' '*.zip' '*.info' '*.torrent' '*.sample*' '*.proof*'
|
||||
@@ -356,44 +352,70 @@ MEDIA_FILE_PATTERNS=(
|
||||
'*.log' '*.json' '*.iso' '*.lrc'
|
||||
)
|
||||
|
||||
# ==============================================================================================
|
||||
# ── TRANSCODES ────────────────────────────────────────────────────────────────────────────────
|
||||
# ==============================================================================================
|
||||
# Session-based storage allocator using filesystem indirection.
|
||||
# New transcode sessions land wherever TRANSCODE_LINK points.
|
||||
# Existing sessions are never interrupted — ffmpeg resolves path once at session start.
|
||||
#
|
||||
# Flow:
|
||||
# ramdisk_setup.sh — run once at array start, creates ramdisk and symlink
|
||||
# transcode_manager.sh — runs every 2-3 min, monitors usage and flips symlink
|
||||
# transcode_cleanup.sh — runs every 5 min, removes old inactive files
|
||||
#
|
||||
# Hysteresis gap between RAMDISK_WARN_GB and RAMDISK_LOW_GB prevents flip-flop
|
||||
# when usage hovers near the threshold. Gap should be at least 0.5-1GB.
|
||||
|
||||
# ━━━ Transcode Manager ━━━
|
||||
# Paths
|
||||
RAMDISK_PATH="/mnt/ramdisk_transcodes" # tmpfs mount point
|
||||
RAMDISK_SIZE="8G" # increase if you have RAM headroom
|
||||
TRANSCODE_LINK="/mnt/user/ram-transcode" # symlink Emby points at
|
||||
TRANSCODE_SSD="/mnt/cache/Temp_Storage/Emby/Transcodes/" # SSD fallback location
|
||||
|
||||
# Thresholds in GB
|
||||
RAMDISK_WARN_GB=6.8 # flip symlink to SSD at or above this usage
|
||||
RAMDISK_LOW_GB=5.5 # flip symlink back to ramdisk when usage drops here
|
||||
RAMDISK_SSD_MIN_GB=20 # minimum free GB on SSD before allowing flip — abort if below
|
||||
|
||||
# Cleanup settings
|
||||
TRANSCODE_MAX_AGE=20 # minutes before a file is eligible for cleanup
|
||||
TRANSCODE_ORPHAN_AGE=30 # minutes before an orphaned file is eligible (slightly longer buffer)
|
||||
|
||||
# Flip frequency monitoring
|
||||
TRANSCODE_FLIP_WARN=3 # notify if symlink flips this many times in one hour
|
||||
|
||||
# Permissions — should match your Emby container user
|
||||
TRANSCODE_OWNER="nobody:users"
|
||||
TRANSCODE_MODE="755"
|
||||
|
||||
# ==============================================================================================
|
||||
# ── SYSTEM WATCHDOG ───────────────────────────────────────────────────────────────────────────
|
||||
# ==============================================================================================
|
||||
# Last line of defense — reboots the system cleanly if it is about to become unstable.
|
||||
# Designed to run on a cron schedule (recommended every 15-30 minutes).
|
||||
# Works alongside docker_watchdog.sh — containers first, system second.
|
||||
#
|
||||
# Strike system — sustained threshold hits trigger reboot, not single spikes.
|
||||
# Reboot loop protection — shuts down instead of rebooting if limit hit in window.
|
||||
# Container skip list — persistent, auto-clears when container recovers.
|
||||
# Thresholds set at "about to fall over" levels — not just high usage.
|
||||
|
||||
# ━━━ System Watchdog State Files ━━━
|
||||
# Strike counts — /tmp resets on reboot, correct for strike tracking
|
||||
SYS_WATCHDOG_STATE_FILE="/tmp/system_watchdog_state.db"
|
||||
# Persistent container skip list — survives reboots, auto-clears on recovery
|
||||
SYS_WATCHDOG_FAILED_FILE="/boot/config/system_watchdog_failed.db"
|
||||
# Reboot timestamp log — survives reboots for loop detection
|
||||
SYS_WATCHDOG_REBOOT_LOG="/boot/config/system_watchdog_reboots.db"
|
||||
|
||||
# ━━━ Strike and Reboot Loop Settings ━━━
|
||||
# Consecutive threshold hits before triggering reboot
|
||||
SYS_WATCHDOG_STRIKE_LIMIT=2
|
||||
# Maximum reboots allowed within the window before shutdown instead
|
||||
SYS_WATCHDOG_REBOOT_LIMIT=3
|
||||
# Window in hours — controls both reboot count window AND rolling log purge
|
||||
# 12 = entries older than 12hrs purge automatically / 24 = entries older than 24hrs purge
|
||||
SYS_WATCHDOG_REBOOT_WINDOW_HRS=12
|
||||
SYS_WATCHDOG_STRIKE_LIMIT=2 # consecutive hits before reboot trigger
|
||||
SYS_WATCHDOG_REBOOT_LIMIT=3 # max reboots in window before shutdown instead
|
||||
SYS_WATCHDOG_REBOOT_WINDOW_HRS=12 # window in hours — controls reboot count AND log purge
|
||||
|
||||
# ━━━ Thresholds ━━━
|
||||
# Set at "about to fall over" levels — not just high usage
|
||||
SYS_WATCHDOG_ROOTFS_PCT=95 # rootfs usage % before strike
|
||||
SYS_WATCHDOG_LOG_PCT=95 # /var/log usage % before strike
|
||||
SYS_WATCHDOG_MEM_GB=4 # free RAM in GB below which strikes
|
||||
SYS_WATCHDOG_ROOTFS_PCT=95 # rootfs % before strike
|
||||
SYS_WATCHDOG_LOG_PCT=95 # /var/log % before strike
|
||||
SYS_WATCHDOG_MEM_GB=4 # free RAM GB below which strikes (128GB system)
|
||||
SYS_WATCHDOG_ARC_PINNED_PCT=98 # ZFS ARC % of max before reclaim attempt
|
||||
SYS_WATCHDOG_ARC_RELEASE_PCT=95 # ZFS ARC % after reclaim that still triggers
|
||||
SYS_WATCHDOG_LOAD_MULTIPLIER=32 # strike if load avg > cores x this value
|
||||
SYS_WATCHDOG_ZOMBIE_LIMIT=50 # strike if zombie process count exceeds this
|
||||
SYS_WATCHDOG_CPU_TEMP_MAX=95 # degrees C — tjmax varies by CPU
|
||||
SYS_WATCHDOG_LOAD_MULTIPLIER=3 # strike if load avg > cores x this value
|
||||
SYS_WATCHDOG_ZOMBIE_LIMIT=50 # strike if zombie count exceeds this
|
||||
SYS_WATCHDOG_CPU_TEMP_MAX=95 # degrees C — adjust for your CPU tjmax
|
||||
|
||||
# ━━━ Check Toggles ━━━
|
||||
# true = run this check / false = skip entirely
|
||||
@@ -402,17 +424,17 @@ MEDIA_FILE_PATTERNS=(
|
||||
SYS_WATCHDOG_CHECK_RAM=true
|
||||
SYS_WATCHDOG_CHECK_ARC=true
|
||||
SYS_WATCHDOG_CHECK_CPU_TEMP=true
|
||||
SYS_WATCHDOG_CHECK_LOAD=true
|
||||
SYS_WATCHDOG_CHECK_LOAD=false
|
||||
SYS_WATCHDOG_CHECK_ZOMBIES=true
|
||||
SYS_WATCHDOG_CHECK_CONTAINERS=true
|
||||
SYS_WATCHDOG_CHECK_DOCKER_DAEMON=true
|
||||
|
||||
# ━━━ Abort Toggles ━━━
|
||||
# true = abort reboot if condition is active / false = reboot anyway
|
||||
# Default true = conservative / set false to reboot regardless
|
||||
# true = abort reboot if condition active / false = reboot anyway
|
||||
# Default true = conservative — set false only when you want "reboot no matter what"
|
||||
SYS_WATCHDOG_ABORT_ON_ZFS_UNHEALTHY=true
|
||||
SYS_WATCHDOG_ABORT_ON_PARITY=false
|
||||
SYS_WATCHDOG_ABORT_ON_MOVER=false
|
||||
SYS_WATCHDOG_ABORT_ON_PARITY=true
|
||||
SYS_WATCHDOG_ABORT_ON_MOVER=true
|
||||
|
||||
# ==============================================================================================
|
||||
# ──────────────────────── End Of User Variables ───────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user