diff --git a/CHANGELOG.md b/CHANGELOG.md index fd3acfce..c5e7c20c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## Unreleased + +- fix: The Log files list now shows new logs without a page reload. (chodeus) +- fix: The Log files icons now follow the theme's text colour. (chodeus) +- fix: Updating the plugin during a move no longer hides the running mover. (chodeus) + +## 2026.11.11a (beta) + +- fix: Updating the plugin during a move no longer hides the running mover. (chodeus) + +## 2026.11.07b (beta) + +- fix: The Log files list now shows new logs without a page reload. (chodeus) +- fix: The Log files icons now follow the theme's text colour. (chodeus) + ## 2026.11.07 - feat: Pause and Resume a run from Main or the Mover Tuning tab. (chodeus) diff --git a/plugins/ca.mover.tuning.plg b/plugins/ca.mover.tuning.plg index 0d41d7f7..19fcb486 100644 --- a/plugins/ca.mover.tuning.plg +++ b/plugins/ca.mover.tuning.plg @@ -799,17 +799,33 @@ else chmod +x /usr/local/sbin/mover fi -# Clean leftover run-state files only if age_mover is NOT running -if ! pgrep -f "age_mover" >/dev/null 2>&1; then +# A run the plugin started: one of these is alive from its before script to its after script +plugin_run_active() { + pgrep -f "age_mover|share_mover|ca\.mover\.tuning/with_scripts" >/dev/null 2>&1 +} + +# Removes mover.pid unless its pid is a mover: Unraid's own mover writes this file too +remove_stale_mover_pid() { + local pid + pid=$(cat /var/run/mover.pid 2>/dev/null) + # a whole argument must name a mover: "mover" alone is also inside every ca.mover.tuning path + if grep -qszE '^(.*/)?(age_|share_)?mover(\.old)?$' "/proc/$pid/cmdline"; then + return 0 + fi + # a mover that started after the read above has put its own pid in the file + if [[ "$(cat /var/run/mover.pid 2>/dev/null)" == "$pid" ]]; then + rm -f /var/run/mover.pid + fi +} + +# Clean leftover run-state files unless a run of the plugin is in progress +if ! plugin_run_active; then echo "Cleaning leftover lock/stop files..." - for file in mover.pid moversoft.stop mover.pause mover.moving; do - if [[ -e "/var/run/$file" ]]; then - rm -f "/var/run/$file" - fi - done + rm -f /var/run/moversoft.stop /var/run/mover.pause /var/run/mover.moving + remove_stale_mover_pid else # no exit here: the permissions, symlink and cron refresh below must run even during a mover run - echo "age_mover is running - leaving its lock/stop files in place." + echo "A Mover Tuning run is in progress - leaving its lock/stop files in place." fi # Renaming mover.cron.disabled to mover.cron if exists (from old cron fix) @@ -876,18 +892,33 @@ The 'remove' script. --> -# Clean leftover run-state files only if age_mover is NOT running -if ! pgrep -f "age_mover" >/dev/null 2>&1; then - echo "Cleaning leftover lock/stop files..." - for file in mover.pid moversoft.stop mover.pause mover.moving; do - if [[ -e "/var/run/$file" ]]; then - rm -f "/var/run/$file" - fi - done -else - echo "WARNING: age_mover is still running - aborting plugin removal." +# A run the plugin started: one of these is alive from its before script to its after script +plugin_run_active() { + pgrep -f "age_mover|share_mover|ca\.mover\.tuning/with_scripts" >/dev/null 2>&1 +} + +# Removes mover.pid unless its pid is a mover: Unraid's own mover writes this file too +remove_stale_mover_pid() { + local pid + pid=$(cat /var/run/mover.pid 2>/dev/null) + # a whole argument must name a mover: "mover" alone is also inside every ca.mover.tuning path + if grep -qszE '^(.*/)?(age_|share_)?mover(\.old)?$' "/proc/$pid/cmdline"; then + return 0 + fi + # a mover that started after the read above has put its own pid in the file + if [[ "$(cat /var/run/mover.pid 2>/dev/null)" == "$pid" ]]; then + rm -f /var/run/mover.pid + fi +} + +# A run of the plugin uses the files removed below; Unraid's own mover does not, so it never blocks removal +if plugin_run_active; then + echo "WARNING: a Mover Tuning run is in progress - aborting plugin removal." exit 1 fi +echo "Cleaning leftover lock/stop files..." +rm -f /var/run/moversoft.stop /var/run/mover.pause /var/run/mover.moving +remove_stale_mover_pid # Restore the mover this plugin backed up below Unraid 7.2.1 only; 7.4 ships its own mover.old UNRAID_VERSION=$(grep '^version=' /etc/unraid-version | cut -d'"' -f2) diff --git a/source/ca.mover.tuning/usr/local/emhttp/plugins/ca.mover.tuning/Mover.tuning.page b/source/ca.mover.tuning/usr/local/emhttp/plugins/ca.mover.tuning/Mover.tuning.page index c8c61687..b82ffe64 100644 --- a/source/ca.mover.tuning/usr/local/emhttp/plugins/ca.mover.tuning/Mover.tuning.page +++ b/source/ca.mover.tuning/usr/local/emhttp/plugins/ca.mover.tuning/Mover.tuning.page @@ -128,6 +128,37 @@ function mtLogLinks() { document.getElementById('moverLogView').href = '/plugins/ca.mover.tuning/viewLog.php?file=' + file; document.getElementById('moverLogSave').href = '/plugins/ca.mover.tuning/viewLog.php?download=1&file=' + file; } +// Picker text, e.g. "2026-11-07 00:00:01 – Debug log"; the stamp is cut as moverLogStamp in logFiles.php cuts it +var mtLogKinds = _('Mover log'), 'Debug_Mover_tuning' => _('Debug log'), 'Summary' => _('Summary')])?>; +function mtLogLabel(name) { + var cut = name.lastIndexOf('_'), kind = name.slice(0, cut), stamp = name.slice(cut + 1, cut + 18); + return stamp.slice(0, 10) + ' ' + [stamp.slice(11, 13), stamp.slice(13, 15), stamp.slice(15, 17)].join(':') + ' – ' + (mtLogKinds[kind] || kind); +} +// a run writes its log when it starts and its summary when it ends, so the tab reads the list again every 10 s +var mtLogShown = null; +function mtShowLogs(names) { + if (Array.isArray(names) === false || names.join('/') === mtLogShown) return; + mtLogShown = names.join('/'); + var $pick = $('#moverLogFile'), picked = $pick.val(); + $pick.empty().append(names.map(function(name) { return $('