Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b7bf007
chore(release): merge master into beta after 2026.11.07 [skip ci]
masterwishx Nov 7, 2026
6e9d3d5
fix: update log file icons to white for better visibility
masterwishx Nov 7, 2026
623d9e4
Refresh the Log files list while the tab is open
chodeus Nov 7, 2026
40de236
Revert "fix: update log file icons to white for better visibility"
masterwishx Nov 7, 2026
4923485
Merge remote-tracking branch 'upstream/beta' into fix/log-list-refresh
chodeus Nov 7, 2026
49fa309
Send one log list request at a time
chodeus Nov 7, 2026
d8dadc5
Put the log icons outside their links, in the theme's text colour
chodeus Nov 7, 2026
eeaab1d
Give the log list request a timeout
chodeus Nov 7, 2026
39f754c
Merge remote-tracking branch 'upstream/beta' into fix/log-list-refresh
chodeus Nov 7, 2026
fb81d32
Merge pull request #278 from chodeus/fix/log-list-refresh
chodeus Nov 7, 2026
1814bd0
chore(beta): release changelog
masterwishx Nov 7, 2026
9908f91
chore(beta): release notes
chodeus Nov 7, 2026
001f196
Merge pull request #279 from masterwishx/release/beta
chodeus Nov 7, 2026
d04a83c
chore(release): 2026.11.07b [skip ci]
masterwishx Nov 7, 2026
06fd68c
Keep a running mover's pid file when the plugin is installed or removed
chodeus Nov 11, 2026
76bfab1
Merge pull request #281 from chodeus/fix/keep-running-mover-pid
chodeus Nov 11, 2026
efdbaf1
chore(beta): release changelog
masterwishx Nov 11, 2026
c78679a
chore(beta): release notes
chodeus Nov 11, 2026
9c20b1b
Merge pull request #282 from masterwishx/release/beta
chodeus Nov 11, 2026
1503324
chore(release): 2026.11.11a [skip ci]
masterwishx Nov 11, 2026
74cabd3
chore(release): merge 2026.11.11a into master for the next stable
masterwishx Nov 11, 2026
b95d851
chore(master): release changelog
masterwishx Nov 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
67 changes: 49 additions & 18 deletions plugins/ca.mover.tuning.plg
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -876,18 +892,33 @@ The 'remove' script.
-->
<FILE Run="/bin/bash" Method="remove">
<INLINE>
# Clean leftover run-state files only if age_mover is NOT running
if ! pgrep -f "age_mover" >/dev/null 2>&amp;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>&amp;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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <?=json_encode(['Mover_tuning' => _('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 $('<option>').val(name).attr('title', name).text(mtLogLabel(name)); }));
if (names.indexOf(picked) !== -1) $pick.val(picked);
$pick.css('display', names.length > 0 ? '' : 'none');
$('#moverLogLinks').css('display', names.length > 0 ? 'flex' : 'none');
$('#moverLogNone').css('display', names.length > 0 ? 'none' : '');
mtLogLinks();
}
$(function() {
// one request at a time, so an older reply can never land after a newer one; the timeout frees a stalled one
var asking = false;
function poll() {
if (document.hidden === true || asking === true) return;
asking = true;
$.ajax({url: '/plugins/ca.mover.tuning/logList.php', data: {_: Date.now()}, dataType: 'json', timeout: 9000})
.done(mtShowLogs).always(function() { asking = false; });
}
setInterval(poll, 10000);
document.addEventListener('visibilitychange', poll);
});
// An emptied Log parent folder is posted as the /tmp default, never as an empty loggingFolder
function mtDefaultLogFolder(form) {
var $f = $(form).find('input[name="loggingFolder"]');
Expand Down Expand Up @@ -757,14 +788,18 @@ _(Logs parent folder for Mover Tuning plugin)_:
</div>

_(Log files)_:
: <?if ($moverLogFiles):?><select id='moverLogFile' aria-label='_(Log files)_' onchange='mtLogLinks()'><?foreach ($moverLogFiles as $moverLogFile):?><option value='<?=htmlspecialchars($moverLogFile, ENT_QUOTES)?>' title='<?=htmlspecialchars($moverLogFile, ENT_QUOTES)?>'><?=htmlspecialchars(moverLogLabel($moverLogFile))?></option><?endforeach;?></select><span style='display:flex;gap:1.5rem'><a id='moverLogView' href='/plugins/ca.mover.tuning/viewLog.php?file=<?=rawurlencode($moverLogFiles[0])?>' target='_blank' rel='noopener'><i class='fa fa-file-text-o'></i> _(View)_</a><a id='moverLogSave' href='/plugins/ca.mover.tuning/viewLog.php?download=1&amp;file=<?=rawurlencode($moverLogFiles[0])?>'><i class='fa fa-download'></i> _(Download)_</a></span><?else:?>_(No log files yet)_<?endif;?>
: <span id='moverLogNone' style='display:none'>_(No log files yet)_</span><select id='moverLogFile' aria-label='_(Log files)_' onchange='mtLogLinks()' style='display:none'></select><span id='moverLogLinks' style='display:none;gap:1.5rem'><span><i class='fa fa-file-text-o'></i> <a id='moverLogView' target='_blank' rel='noopener'>_(View)_</a></span><span><i class='fa fa-download'></i> <a id='moverLogSave'>_(Download)_</a></span></span>

:mover_tune_logfiles_plug:

> The newest file is on top: the log of the latest run. <strong>View</strong> opens it in a new browser tab.

:end

<script>
mtShowLogs(<?=json_encode($moverLogFiles)?>);
</script>

<div markdown="1" class="moverTuningSettings">

_(Delete Mover Log files over than this days old)_:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,4 @@ function moverLogFiles(array $cfg): array {
function moverLogStamp(string $name): string {
return substr($name, strrpos($name, '_') + 1, 17);
}

// Picker text, e.g. "2026-11-07 00:00:01 – Debug log"; needs the page's _()
function moverLogLabel(string $name): string {
$kinds = ['Mover_tuning' => _('Mover log'), 'Debug_Mover_tuning' => _('Debug log'), 'Summary' => _('Summary')];
$stamp = moverLogStamp($name);
$kind = substr($name, 0, strrpos($name, '_'));
return substr($stamp, 0, 10) . ' ' . implode(':', str_split(substr($stamp, 11), 2)) . ' – ' . ($kinds[$kind] ?? $kind);
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?PHP
// The names for the Log files row on the Mover Tuning tab, newest first: the files viewLog.php serves.
require_once '/usr/local/emhttp/plugins/ca.mover.tuning/logFiles.php';
$cfg = @parse_ini_file('/boot/config/plugins/ca.mover.tuning/ca.mover.tuning.cfg');
header('Content-Type: application/json');
echo json_encode(array_keys(moverLogFiles(is_array($cfg) === true ? $cfg : [])));
?>
Loading