Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
c810c31
first try to fix spaces issue
masterwishx Feb 7, 2025
9dccf00
plg version changed
masterwishx Feb 7, 2025
bfef0c6
try2
masterwishx Feb 7, 2025
a748118
check back to original L676
masterwishx Feb 7, 2025
2bbc085
Fix added for spaces in L680-687
masterwishx Feb 7, 2025
fc832fd
user back in plg
masterwishx Feb 7, 2025
3892495
make easy code L591
masterwishx Feb 7, 2025
bc69c83
redme updated
masterwishx Feb 7, 2025
7888f10
fix date
masterwishx Feb 7, 2025
24465e2
fix space (-gt) L318
masterwishx Feb 7, 2025
f489255
first addon of dataset unmount/delete
masterwishx Feb 8, 2025
0c24dfa
move to function + add to php
masterwishx Feb 8, 2025
033c92c
fix `dataset_file_count` path
masterwishx Feb 8, 2025
920969a
remove 2>&1
masterwishx Feb 8, 2025
f02926c
add checks for unmount/destroy datasets
masterwishx Feb 9, 2025
c5f5e72
readme updated
masterwishx Feb 9, 2025
4999cdf
fix readme
masterwishx Feb 9, 2025
6331d73
add ZFS word to dataset to .page and remove uneeded fix until update …
masterwishx Feb 9, 2025
8f1bfa1
remove typo space in .plg
masterwishx Feb 9, 2025
9fc6386
add ZFS word to dataset in age_mover code
masterwishx Feb 9, 2025
06948ca
add ZFS to mvlogger in age_mover
masterwishx Feb 10, 2025
e41ae69
Format clean ZFS dataset code
masterwishx Feb 10, 2025
f27f2c9
Format all document age_mover (remove spaces etc)
masterwishx Feb 10, 2025
4bb981f
try github action
masterwishx Feb 12, 2025
f098e69
plg changed
masterwishx Feb 12, 2025
485937e
move back from github action + change to masterwishx
masterwishx Feb 12, 2025
6624894
update version + package compiled
masterwishx Feb 12, 2025
c47f74f
small cometics
masterwishx Feb 13, 2025
69b70be
FINDSTR+= to FINDSTR="$FINDSTR
masterwishx Feb 14, 2025
8c07ff7
some fixes
masterwishx Feb 14, 2025
f1ee4ab
typo fix
masterwishx Feb 14, 2025
b201ca9
some more fixes
masterwishx Feb 14, 2025
35e96da
! -z change to -n
masterwishx Feb 15, 2025
3636c02
mvlogger to `HIDDENFILES_RESERVED_SPACE` for hidden files , more spee…
masterwishx Feb 15, 2025
3f204ec
add some quotes
masterwishx Feb 15, 2025
86da029
add zfs dataset child check befor destroy dataset
masterwishx Feb 16, 2025
6f9869f
add -z to check
masterwishx Feb 16, 2025
e6f62f9
FINDSTR back working case L728
masterwishx Feb 16, 2025
aa79549
change desc for clean zfs dataset
masterwishx Feb 16, 2025
9ea7c26
make bold in mover page for info of clean setting
masterwishx Feb 16, 2025
10c9277
add note for test mode also change note for disable plugin
masterwishx Feb 16, 2025
a638918
change notes again
masterwishx Feb 16, 2025
c517ad2
note more clear in page
masterwishx Feb 16, 2025
7d63394
some cosmetic better look in page
masterwishx Feb 16, 2025
a9b3d2c
bold more text
masterwishx Feb 16, 2025
da60e49
check added for only one share in pool when usecache only for skip ca…
masterwishx Feb 18, 2025
3401a64
change min threshhold 5% to 0%
masterwishx Feb 18, 2025
16d20f1
new version update
masterwishx Feb 18, 2025
76a761b
remove unneeded links in text
masterwishx Feb 18, 2025
fd87a2b
fix version number
masterwishx Feb 18, 2025
6796527
package added
masterwishx Feb 18, 2025
719c9ee
add version + changelog to plg and readme
masterwishx Feb 19, 2025
06a0061
updated by readme updated
masterwishx Feb 19, 2025
eed86ec
finished pkg build
masterwishx Feb 20, 2025
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
5 changes: 4 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Auto detect text files and perform LF normalization
* text=auto
* text=auto eol=lf

# Custom for Visual Studio
*.cs diff=csharp
Expand All @@ -15,3 +15,6 @@
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

# Custom for PHP files with syntax highlighting
*.page text eol=lf lang=php
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/

# Updates by pr in new version
.updates.txt

# Windows Installer files
*.cab
*.msi
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ For each file, if the file is not "in use" by any process (as detected by 'fuser
If an error occurs in copying a file, the partial file, if present, is deleted and the operation continues on to the next file.

## Changelog
- 2025.02.18.1752
- [Check parent empty ZFS dataset for children empty datasets before destroy it.](https://github.com/masterwishx/ca.mover.tuning/pull/1) ([masterwishx](https://github.com/masterwishx))
- Shell Check Fixes + speedup `if` checks.
- Better help text cosmetic with Bold and italic + added note for Test Mode and some changes in config page.
- Skip cache pool size calculation when only one share found in cache pool.
- Changed minimum threshold of used Primary (cache) space from 5% to 0%.
- 2025.02.12.1707
- [Fix issue for shares with spaces](https://github.com/R3yn4ld/ca.mover.tuning/pull/69) Thanks [DToX_](https://forums.unraid.net/topic/176951-mover-is-refusing-to-move-any-files-off-the-cache-from-a-share-with-a-space-in-the-name/#findComment-1521811) from forums. ([masterwishx](https://github.com/masterwishx))
- [Add option to clean ZFS datasets](https://github.com/R3yn4ld/ca.mover.tuning/pull/69) ([masterwishx](https://github.com/masterwishx))
- 2024.09.05.0222
- [Fix find not finding hidden files](https://github.com/R3yn4ld/ca.mover.tuning/pull/67) Thanks to [solidno8](https://forums.unraid.net/topic/70783-plugin-mover-tuning/?do=findComment&comment=1461454) from forums. ([R3yn4ld](https://github.com/R3yn4ld))
- 2024.09.05.0115
Expand Down Expand Up @@ -166,3 +175,4 @@ See the [Mover Tuning_ thread on the Unraid support forum](https://forums.unraid
## Thanks

This was originally created by [Squid](https://github.com/Squidly271) and updated by [hugenbd](https://github.com/hugenbd/ca.mover.tuning), with contributions by [Castcore](https://github.com/Castcore), [Swarles](https://github.com/hugenbd/ca.mover.tuning/commit/64e06e91bd83431d768346e4d8158f7be039564e), [Dphelan](https://github.com/dphelan) and [Davendsai](https://github.com/davendesai).
@2025 Updated by [masterwishx](https://github.com/masterwishx/ca.mover.tuning).
Binary file not shown.
Binary file not shown.
19 changes: 15 additions & 4 deletions plugins/ca.mover.tuning.plg
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN [
<!ENTITY name "ca.mover.tuning">
<!ENTITY author "Reynald">
<!ENTITY version "2024.09.05.0222">
<!ENTITY md5 "a367c78a27e2254742437ee2b14df87c">
<!ENTITY author "masterwishx">
<!ENTITY version "2025.02.18.1752">
<!ENTITY md5 "908f9efa690790a104a2bf95acff5ac1">
<!ENTITY launch "Settings/Scheduler">
<!ENTITY plugdir "/usr/local/emhttp/plugins/&name;">
<!ENTITY github "R3yn4ld/ca.mover.tuning">
<!ENTITY github "masterwishx/ca.mover.tuning">
<!ENTITY branch "master">
<!ENTITY upgrade "minor">
<!ENTITY pluginURL "https://raw.githubusercontent.com/&github;/master/plugins/&name;.plg">
Expand All @@ -15,6 +15,17 @@
<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;" icon="wrench" min="6.9.0-rc2">

<CHANGES>
###2025.02.18.1752
- [Check parent empty ZFS dataset for children empty datasets before destroy it.](https://github.com/masterwishx/ca.mover.tuning/pull/1) ([masterwishx](https://github.com/masterwishx))
- Shell Check Fixes + speedup `if` checks.
- Better help text cosmetic with Bold and italic + added note for Test Mode and some changes in config page.
- Skip cache pool size calculation when only one share found in cache pool.
- Changed minimum threshold of used Primary (cache) space from 5% to 0%.

###2025.02.12.1707
- Fix issue for shares with spaces.Thanks DToX_ from forums. [masterwishx]
- Add option to clean ZFS datasets. [masterwishx]

###2024.09.05.0222
- Fix find not finding hidden files. Thanks solidno8 from forums. [R3yn4ld]
2024.09.05.0115
Expand Down
59 changes: 55 additions & 4 deletions source/ca.mover.tuning/pkg_build.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,72 @@
#!/bin/bash

# Get the directory of the script
DIR="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"

# Set the temporary directory and plugin name
tmpdir=/tmp/tmp.$(( $RANDOM * 19318203981230 + 40 ))
plugin=$(basename ${DIR})
archive="$(dirname $(dirname ${DIR}))/archive"
version=$(date +"%Y.%m.%d.%H%M")$1
config_file=/mnt/cache/appdata/Development/github-desktop/GitHub/ca.mover.tuning//plugins/ca.mover.tuning.plg
# $2 is argument addition to date (a,b,c)
version=$(date +"%Y.%m.%d")$2
# $1 Path to the plugin directory
config_file="$1/ca.mover.tuning/plugins/ca.mover.tuning.plg"
readme_file="$1/ca.mover.tuning/README.md"

# Create the temporary directory and copy files
mkdir -p $tmpdir

# Get the content from .update file
update_content="$(dirname $(dirname "$DIR"))/.updates.txt"

cp --parents -f $(find . -type f ! \( -iname "pkg_build.sh" -o -iname "sftp-config.json" \) ) $tmpdir/

cd $tmpdir

# Build the package using makepkg
makepkg -l y -c y ${archive}/${plugin}-${version}-x86_64-1.txz
rm -rf $tmpdir

# Calculate the MD5 hash of the package
package_md5=$(md5sum ${archive}/${plugin}-${version}-x86_64-1.txz | awk '{print $1}')

echo "Version: $version"
echo "MD5: $package_md5"
echo ""
echo "Update Content: $update_content"
echo ""
echo "Updating ca.mover.plugin.plg"
echo "Updating README.md"

sed -i "s/<!ENTITY md5.*/<!ENTITY md5 \"$package_md5\">/" "$config_file"
sed -i "s/<!ENTITY version.*/<!ENTITY version \"$version\">/" "$config_file"
sed -i "s/<!ENTITY version.*/<!ENTITY version \"$version\">/" "$config_file"

# Define variables for your files and version
tmp_config_file="$tmpdir/tmp_config_file.txt"
tmp_readme_file="$tmpdir/tmp_readme_file.txt"

# Modify the config file (*.plg) with changelog
# Step 1: Cut content after ### from $config_file to $tmp_config_file
sed -n '/###*/,$p' "$config_file" > "$tmp_config_file"
# Step 2: Dlete evrything after ### in $config_file
sed -i '/###*/,$d' "$config_file"
# Step 3: Add version to $config_file
sed -i '$a\###'${version}'' "$config_file"
# Step 4: Add content from $update_content to $config_file
cat "$update_content" >> "$config_file"; echo -e "\n" >> "$config_file"
# Step 5: Add content from $tmp_config_file to $config_file
cat "$tmp_config_file" >> "$config_file"

# Modify the readme file with changelog
# Step 1: Cut content after ## Changelog from $readme_file to $tmp_readme_file
sed -n '/- 20*/,$p' "$readme_file" > "$tmp_readme_file"
# Step 2: Dlete evrything after ## Changelog in $readme_file
sed -i '/- 20*/,$d' "$readme_file"
# Step 3: Add version to $readme_file
sed -i '$a\- '${version}'' "$readme_file"
# Step 4: Add content from $update_content to $readme_file
cat "$update_content" | sed -e 's/^/ /' >> "$readme_file"; echo -e "\n" >> "$readme_file"
# Step 5: Add content from $tmp_readme_file to $readme_file
cat "$tmp_readme_file" >> "$readme_file"

# Clean up the temporary directory
rm -rf $tmpdir
Original file line number Diff line number Diff line change
Expand Up @@ -110,26 +110,27 @@ Disable Mover running on a schedule:
<?=mk_option($cfg['moverDisabled'],"no","No")?>
<?=mk_option($cfg['moverDisabled'],"yes","Yes")?>
</select>
* Note that setting this to yes effectively disables this plugin
<strong>Yes</strong> <em>- setting effectively disables this plugin</em>

> This will prevent mover from running at the schedule set in Mover Settings. You will only be able to run mover by manually invoking it.
> This will <strong>prevent</strong> mover from running at the schedule set in Mover Settings. You will only be able to run mover by <strong>manually</strong> invoking it.

<div markdown="1" id="moverTuningSettings">
Test Mode (dry run):
: <select name='testmode' size='1' class='narrow'>
<?=mk_option($cfg['testmode'],"no",'No')?>
<?=mk_option($cfg['testmode'],"yes","Yes")?>
</select>
<strong>No</strong> <em>- setting effectively disables test mode</em>

> Test Mode will not run mover but will output the custom find command results to /tmp/ca.mover.tuning/. Caution - If you have "Move Now button follows plug-in filters" set to no, original Mover will still run.
> Test Mode will <strong>Not</strong> run mover but will output the custom find command results to <em>/tmp/ca.mover.tuning/</em>. Caution - If you have "Move Now button follows plug-in filters" set to <strong>No</strong>, original Mover will still run.

Log Mover Tuning plugin actions
: <select name='logging' size='1' class='narrow'>
<?=mk_option($cfg['logging'],"no",'No')?>
<?=mk_option($cfg['logging'],"yes","Yes")?>
</select>

> Enables or disables logging from this plugin. Logs are displayed in syslog and stored at /tmp/ca.mover.tuning
> Enables or disables logging from this plugin. Logs are displayed in syslog and stored at <em>/tmp/ca.mover.tuning</em>

Show advanced settings:
: <select name='advancedSettings' size='1' class='narrow' onchange="updateScreenMoverAdvancedSettings(this.value, 'slow')">
Expand Down Expand Up @@ -175,7 +176,7 @@ Force move of all files on a schedule:
Cron Schedule to force move all of files:
: <input type='text' id='cronSchedule' name='cron' size='1' class='narrow mycron' value='<?=$cfg['cron']?>' <?=$cronDisabled?>>

> Cron Schedule entry example 20 4 1 * * To run the first day of the month at 4:20 AM
> Cron Schedule entry example <strong>20 4 1 * *</strong>. To run the <em>first day of the month at </em><strong>4:20 AM</strong>

Allow force mover schedule to run during a parity check/rebuild:
: <select name='forceParity' size='1' class='narrow mycron' <?=$cronDisabled?>>
Expand Down Expand Up @@ -204,14 +205,14 @@ Move Now button follows plug-in filters:
<?=mk_option($cfg['movenow'],"yes","Yes")?>
</select>

> Select yes to to follow plug-in filters, no to run original mover from button.
> Select <strong>Yes</strong> to to follow plug-in filters, <strong>No</strong> to run original mover from button.
</div>

<div class="title"><span class="center"><i class="fa fa-filter title"></i>Filters</span></div>

Only move if above this threshold of used Primary (cache) space:
: <select name="movingThreshold" size="1" class='narrow'>
<?for ($t=95;$t>0;$t-=5):?>
<?for ($t=95;$t>=0;$t-=5):?>
<?=mk_option($cfg['movingThreshold'], $t, "$t %")?>
<?endfor;?>
</select>
Expand Down Expand Up @@ -251,7 +252,7 @@ Move files that are greater than this many days old:
<?=mk_option($cfg['daysold'], $dt, "$dt")?>
<?endfor;?>
</select>
'Auto' setting enable smart caching
<strong>Auto</strong> <em>- setting enable smart caching</em>

> Select the number of days old a file has to be in order to move (Up To 1 year). Auto will move from the oldest to the most recent, until threshold is met.

Expand Down Expand Up @@ -305,7 +306,7 @@ Move files off Primary (cache) based on sparseness?
<?=mk_option($cfg['sparsnessf'],'yes','Yes')?>
</select>

> Select the sparseness size. Any file with a sparseness larger will be moved.
> Select the sparseness size. Any file with a sparseness larger will be moved.

Move files that are greather than this sparseness:
: <select name="sparsnessv" size="1" class='narrow mysparsnessf' <?=$sparsnessfDisabled?>>
Expand Down Expand Up @@ -351,16 +352,16 @@ Ignore All hidden files and directories
</select>

> Very few will use this, keep set to No.
> Removes any files or directories that start with a .
> Adds -not -path '*/\.*' to the end of the find command.
> Removes any files or directories that start with a <strong>.</strong>
> Adds <em>-not -path '*/\.*'</em> to the end of the find command.

Move All from Primary->Secondary (cache:yes) shares when disk is above a certain percentage:
: <select name='omovercfg' size='1' class='narrow' onchange='$(".myomthresh").toggleAttr("disabled")'>
<?=mk_option($cfg['omovercfg'],"no","No")?>
<?=mk_option($cfg['omovercfg'],"yes","Yes")?>
</select>

> Set to "Yes" if you want to move all files from a Primary->Secondary (cache:yes) share to the array if the percentage below is exceeded. This is similar to the original mover and does not apply any filters from this plug-in to the find command sent to the mover binary.
> Set to "<strong>Yes</strong>" if you want to move all files from a Primary->Secondary (cache:yes) share to the array if the percentage below is exceeded. This is similar to the original mover and does not apply any filters from this plug-in to the find command sent to the mover binary.

Move All from Primary->Secondary shares pool percentage:
: <select name="omoverthresh" size="1" class='narrow myomthresh' <?=$omoverthreshDisabled?>>
Expand All @@ -369,7 +370,7 @@ Move All from Primary->Secondary shares pool percentage:
<?endfor;?>
</select>

> Set to the amount of disk space used on the Primary pool to initiate a move of all files in a Primary->Secondary (cache:yes) share. Filters will still run after, for any remaining pool's that do not meet this threshold. This threshold should at a minimum be 5% larger than "Only move at this threshold of used primary (cache) space:" above.
> Set to the amount of disk space used on the Primary pool to initiate a move of all files in a Primary->Secondary (cache:yes) share. Filters will still run after, for any remaining pool's that do not meet this threshold. This threshold should at a minimum be 5% larger than "Only move at this threshold of used primary (cache) space:" above.


</div>
Expand All @@ -390,7 +391,16 @@ Clean empty folders
<?=mk_option($cfg['cleanFolders'],"yes","Yes")?>
</select>

> This will clean the parent folder (only) of moved file.
> This will remove the parent folder <strong>only of moved</strong> files.

Clean empty ZFS datasets
: <select name='cleanDatasets' size='1' class='narrow'>
<?=mk_option($cfg['cleanDatasets'],"no",'No')?>
<?=mk_option($cfg['cleanDatasets'],"yes","Yes")?>
</select>

> This will <strong>unmount</strong> and <strong>destroy</strong> the parent ZFS dataset on share of moved files, <strong>only if not contain</strong> child datasets within.


Synchronize Primary files to Secondary
: <select name='synchronizeCache' size='1' class='narrow'>
Expand Down
Loading