Skip to content

Add Mover Status 6.13#1042

Open
SimonFair wants to merge 30 commits into
unraid:masterfrom
SimonFair:Mover-Progress-NCHAN-rc3+
Open

Add Mover Status 6.13#1042
SimonFair wants to merge 30 commits into
unraid:masterfrom
SimonFair:Mover-Progress-NCHAN-rc3+

Conversation

@SimonFair

@SimonFair SimonFair commented Mar 8, 2022

Copy link
Copy Markdown
Contributor

Initial code for 6.10+

Summary by CodeRabbit

  • New Features
    • Added “Mover Progress” support to display real-time mover status, including current activity, throughput, percent complete, and estimated time remaining.
    • Added a new “Mover Progress” scheduler setting (enabled/disabled) with contextual help text for override behavior.
  • UI Improvements
    • Updated the mover schedule display to dynamically show or hide progress rows based on current mover state and available line counts.
    • Improved progress handling so the mover UI reflects calculated totals and per-pass progress during operations.

@SimonFair SimonFair marked this pull request as draft March 8, 2022 20:25
@SimonFair SimonFair changed the title Initial Commit for Mover Status rc3+ Add Mover Status rc3+ Mar 8, 2022
@SimonFair

SimonFair commented Mar 9, 2022

Copy link
Copy Markdown
Contributor Author

Example View

image

@bergware

Copy link
Copy Markdown
Contributor

Very nice!
I like it.

@SimonFair SimonFair marked this pull request as ready for review March 20, 2022 11:05
@SimonFair

SimonFair commented Mar 20, 2022

Copy link
Copy Markdown
Contributor Author

@limetech these changes will be pending your mover and move changes needed to made mover.ini in state dir.

@SimonFair

SimonFair commented Apr 2, 2022

Copy link
Copy Markdown
Contributor Author

Gist for my current test mover script https://gist.github.com/SimonFair/91d54c983a8c9b09c0d803baa25f01ac

@SimonFair SimonFair closed this May 9, 2022
@SimonFair SimonFair reopened this May 26, 2022
@limetech

Copy link
Copy Markdown
Contributor

it's baaaaaaaaaaack

@SimonFair

SimonFair commented Jun 2, 2022

Copy link
Copy Markdown
Contributor Author

@limetech Started creating a php version of the mover script to allow status to show file name and current action. But I still need to look at is the progress for each file. Can you provide details of now to get the ioctl from move so I can update the nchan for parity_list to get the progress. Or if you have another way you would like to progress let me know.

WIP https://gist.github.com/SimonFair/5e1f318b20e43afc01dcf29a78aee2c1

image
image
image

@SimonFair SimonFair changed the title Add Mover Status rc3+ Add Mover Status 6.10 Jun 5, 2022
@LoveBootCaptain

Copy link
Copy Markdown

any info from @limetech when or if this PR get merged?

@chrisallen

chrisallen commented Dec 16, 2022

Copy link
Copy Markdown

Wow this looks amazing!

@okiyama

okiyama commented Jul 20, 2023

Copy link
Copy Markdown

Bump, this would be a great feature

@Joly0

Joly0 commented Nov 24, 2023

Copy link
Copy Markdown
Contributor

Any news on this one?

@SimonFair SimonFair changed the title Add Mover Status 6.10 Add Mover Status 6.13 Nov 26, 2023
@JanEisen

Copy link
Copy Markdown

why is this not being merged? would be so great to have!

@nebb00

nebb00 commented Jul 4, 2024

Copy link
Copy Markdown

is it possible to have this notify the apprise api of its progress ?

@Joly0

Joly0 commented Dec 12, 2024

Copy link
Copy Markdown
Contributor

Is there any reason, why this hasnt been merged yet? Would love to see this feature implemented in unraid 7.1

@skycryer

Copy link
Copy Markdown

Can someone solve the conflicts and merge it into 7 please?

@SimonFair

Copy link
Copy Markdown
Contributor Author

Can someone solve the conflicts and merge it into 7 please?

Unlikely at this point as backend changes are required for pool to pool and progress. These are just the GUI changes.

@ljm42 ljm42 added the TBD label Apr 29, 2025
@coderabbitai

coderabbitai Bot commented Apr 29, 2025

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c6ab9ad9-4803-4d3b-bd32-4949f70953d9

📥 Commits

Reviewing files that changed from the base of the PR and between defeec9 and 3080303.

📒 Files selected for processing (1)
  • sbin/mover
🚧 Files skipped from review as they are similar to previous changes (1)
  • sbin/mover

Walkthrough

Adds end-to-end mover progress reporting: sbin/mover gains writestatus() instrumentation, calculate_totals(), and per-file progress tracking; parity_list reads mover.ini and publishes structured payloads over /sub/mover; ArrayOperation.page adds a websocket subscriber and five live-update HTML rows; MoverSettings.page adds a shareMoverProgress config option; and sbin/mover.old is added as a preserved copy of the previous mover script.

Changes

Mover Progress Feature

Layer / File(s) Summary
MoverSettings control and help text
emhttp/plugins/dynamix/MoverSettings.page, emhttp/languages/en_US/helptext.txt
MoverSettings.page adds a shareMoverProgress select defaulting to "disabled" with a :mover_progress_help: hook; helptext.txt defines that helptext block.
sbin/mover.old – preserved legacy script
sbin/mover.old
Adds the complete prior Bash mover script with PID-file single-instance enforcement, share-iteration for yes/prefer cache modes, optional disk-emptying, killtree(), stop(), and start/stop/status CLI dispatch.
sbin/mover status-file instrumentation and totals
sbin/mover
Adds MOVERSTATUS/per-share associative arrays, helper functions for i18n escaping/size/rate/ETA/percent, writestatus(), calculate_totals() to precompute TOTAL/REMAIN, move() instrumented with per-file writestatus() calls and REMAIN decrements, and start() reworked to emit status during totals phase with final PID+MOVERSTATUS cleanup.
parity_list nchan publisher for /sub/mover
emhttp/plugins/dynamix/nchan/parity_list
Adds $mover_old state, mover_percent/mover_html/mover_duration/mover_bar helpers, and a $process == 2 block that reads mover.ini, computes progress/ETA, assembles a Showlines/Selectlines/HTML payload, and publishes the mover topic; loop sleep changes to sleep($timer) (1 when mover active, 3 otherwise).
ArrayOperation.page websocket subscriber and live mover rows
emhttp/plugins/dynamix/ArrayOperation.page
Adds maxmoverlines constant, hiding of #moverrow0#moverrow4 across normal/parity/BTRFS array state branches, a moverStatus websocket subscriber for /sub/mover with JSON/fallback parsing and Selectlines-driven row visibility, and five hidden HTML rows with movertitle/moverline target elements.

Sequence Diagram(s)

sequenceDiagram
  rect rgba(70, 130, 180, 0.5)
    note over mover,MOVERSTATUS: Backend progress computation
    participant mover as sbin/mover
    participant MOVERSTATUS as mover.ini
    mover->>MOVERSTATUS: write "Calculating totals"
    mover->>mover: calculate_totals()
    mover->>MOVERSTATUS: write per-file status (percent, ETA, speed)
  end
  rect rgba(100, 160, 100, 0.5)
    note over parity_list,nchan: nchan publish
    participant parity_list as parity_list
    participant nchan as /sub/mover
    parity_list->>MOVERSTATUS: read mover.ini
    parity_list->>parity_list: compute Showlines/Selectlines/HTML bars
    parity_list->>nchan: publish_noDupe('mover', json payload)
  end
  rect rgba(180, 100, 70, 0.5)
    note over Browser,MoverRows: Browser UI update
    participant Browser as Browser
    participant moverStatus as moverStatus subscriber
    participant MoverRows as moverrow0–4 DOM
    nchan->>Browser: mover status event
    Browser->>moverStatus: parse JSON
    moverStatus->>MoverRows: inject title/progress HTML by key
    moverStatus->>MoverRows: show/hide rows by Selectlines
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐇 Hopping through the cache with glee,
Each file tracked for all to see!
Progress bars now fill the screen,
Mover status, crisp and clean.
Bytes computed, ETA shown —
No more moving in the unknown! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Mover Status 6.13' refers to a real aspect of the changeset—adding mover status monitoring—but lacks specificity about the scope and primary changes (GUI improvements, backend script modifications, configuration options).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@johntdyer

Copy link
Copy Markdown

Really hoping this makes it in soon, seems like a great addition with most of the heavy lifting already done

@RobertCajun

Copy link
Copy Markdown

Can we potentially get an update on this?

@kronflux

kronflux commented Sep 8, 2025

Copy link
Copy Markdown

+1 for this, this would be fantastic

@omarahmed786

Copy link
Copy Markdown

Would love this to be added soon!

@PilaScat

PilaScat commented Jan 2, 2026

Copy link
Copy Markdown

+1

@ChristianWilkie

Copy link
Copy Markdown

Came across this when searching for a way to monitor mover progress - this would be a great feature!

@elibosley

Copy link
Copy Markdown
Member

@SimonFair do you want to rebase this

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2026.06.23.0822
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-1042/webgui-pr-1042.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates
  • Post-merge behavior: This preview stays available after merge until preview storage expires or it is manually cleaned up

📝 Modified Files:

Click to expand file list
emhttp/languages/en_US/helptext.txt
emhttp/plugins/dynamix/ArrayOperation.page
emhttp/plugins/dynamix/MoverSettings.page
emhttp/plugins/dynamix/nchan/parity_list
sbin/mover
sbin/mover.old

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-1042, or run:

plugin remove webgui-pr-1042

🤖 This comment is automatically generated and will be updated with each new push to this PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@emhttp/plugins/dynamix/ArrayOperation.page`:
- Around line 517-528: The issue is that when moverlines decreases from a higher
value, previously visible rows above the new limit remain visible instead of
being hidden, because only rows 0 through moverlines-1 are updated in the
visibility loop. Before the main loop starting with `for (let i = 0; i <
moverlines; i++)`, add a reset loop to hide all mover rows (from 0 through
maxmoverlines) to ensure that any rows now outside the updated range are
properly hidden regardless of their previous visibility state.

In `@emhttp/plugins/dynamix/MoverSettings.page`:
- Around line 137-145: The form control for `shareMoverProgress` is defined in
the MoverSettings.page file but lacks backend implementation. You need to add
code to read the `shareMoverProgress` setting from the configuration storage,
pass this value to the mover process or service that handles progress display
functionality, and implement the conditional logic to enable or disable progress
display based on whether the setting is "enabled" or "disabled". This ensures
the toggle state actually affects the mover's behavior rather than just
persisting without effect.

In `@sbin/mover`:
- Around line 75-81: The PID file creation using the echo statement that writes
to /var/run/mover.pid needs to be moved to execute before the sleep 5 command
rather than after. Move the line containing echo $$ >/var/run/mover.pid to
execute immediately after the writestatus call and before the sleep 5 statement
to ensure the PID file is created early and prevent a race condition where a
second mover instance could start during the sleep window before the first
instance has written its PID.

In `@sbin/mover.old`:
- Around line 48-55: The stop and status command sections (at lines 134-143 and
163-165) do not validate that the PID in the file actually belongs to the mover
process before acting on it, unlike the startup section which checks with ps and
grep. Add the same PID ownership validation check (ps h $(cat $PIDFILE) | grep
mover) to both the stop function before calling killtree and the status function
before reporting the process as running, ensuring that only the actual mover
process is terminated or reported, preventing the termination of unrelated
processes with reused or stale PIDs.
- Around line 99-103: The EMPTYING variable can be blank, which causes the for
loop over the arr array to iterate with an empty DISK value, resulting in
scanning /mnt directly. Add a guard condition to check if the EMPTYING variable
is not empty before entering the for DISK in "${arr[@]}" loop. If EMPTYING is
empty, skip the entire disk iteration to prevent unintended operations on the
/mnt root directory.

In `@sbin/moverprogress`:
- Around line 144-145: The variables $DUARGSI and $DUARGSO containing file paths
are being directly interpolated into shell commands passed to shell_exec(),
which creates a shell injection vulnerability. Escape these variables using the
escapeshellarg() function before concatenating them into the shell commands to
prevent malicious input from breaking or manipulating the du commands. Apply
this same escapeshellarg() protection to all other instances mentioned in the
comment at lines 172, 177, 184-185, 217, 222, and 229-230 where file paths are
being concatenated into shell commands.
- Around line 72-76: In the startMover() function where the PID file content is
checked, add process liveness verification before refusing startup. Instead of
immediately exiting when the PID file exists, first check if the process with
that PID is actually running using a system call like kill -0 or equivalent.
Only exit with the "already running" message if the process is confirmed to be
alive. If the process is not running, allow the startup to proceed and
optionally clean up the stale PID file to prevent future blocks.
- Around line 263-275: The stopMover() function reads the process ID from the
PID file but never actually terminates the running mover process before removing
the PID file. After validating that $pid exists, you need to actually kill the
process using a system call like posix_kill() or exec() to send a termination
signal to the process with the retrieved $pid before sleeping and removing the
/var/run/mover.pid file. This ensures the mover process is properly terminated
rather than just orphaning it while the UI reports it as stopped.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: eb2452a6-b999-4cc9-8b2e-831134540ab0

📥 Commits

Reviewing files that changed from the base of the PR and between cc6a800 and 68aece2.

📒 Files selected for processing (7)
  • emhttp/languages/en_US/helptext.txt
  • emhttp/plugins/dynamix/ArrayOperation.page
  • emhttp/plugins/dynamix/MoverSettings.page
  • emhttp/plugins/dynamix/nchan/parity_list
  • sbin/mover
  • sbin/mover.old
  • sbin/moverprogress

Comment thread emhttp/plugins/dynamix/ArrayOperation.page
Comment thread emhttp/plugins/dynamix/MoverSettings.page
Comment thread sbin/mover
Comment thread sbin/mover.old
Comment thread sbin/mover.old
Comment thread sbin/moverprogress Outdated
Comment thread sbin/moverprogress Outdated
Comment thread sbin/moverprogress Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sbin/mover`:
- Around line 271-279: The calculate_totals function is being called
unconditionally even when mover progress is disabled, causing unnecessary tree
scanning. Wrap the calculate_totals function call and the related writestatus
calls (the ones before and after it) in a conditional block that checks if
mover_progress_enabled is true, so that the expensive tree walk is skipped when
progress tracking is disabled.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4c08eb94-80c2-47cd-91ef-b381b752a3b4

📥 Commits

Reviewing files that changed from the base of the PR and between 68aece2 and 60ac24a.

📒 Files selected for processing (3)
  • emhttp/plugins/dynamix/ArrayOperation.page
  • emhttp/plugins/dynamix/nchan/parity_list
  • sbin/mover
🚧 Files skipped from review as they are similar to previous changes (1)
  • emhttp/plugins/dynamix/ArrayOperation.page

Comment thread sbin/mover Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.