Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touch not running after update to snapraid 12.3 #92

Closed
CIWXd opened this issue Apr 4, 2024 · 2 comments
Closed

Touch not running after update to snapraid 12.3 #92

CIWXd opened this issue Apr 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@CIWXd
Copy link

CIWXd commented Apr 4, 2024

Since I updated to snapraid 12.3 I noticed an increasing number of files with a zero sub-second timestamp in the snapraid status part of my mail notification.
It was strange since the snapraid touch part of this script should correct these files on the next run.
It did not.

The reason is a small change in the output of the command "snapraid status" in snapraid 12.3.

From (before snapraid 12.3): You have %u files with zero sub-second timestamp.
https://github.com/amadvance/snapraid/blob/986e16b4e87437eb2d7a018a2dd714be44db7f04/cmdline/status.c#L483

To (since snapraid 12.3): You have %u files with a zero sub-second timestamp.
https://github.com/amadvance/snapraid/blob/cd327c60c79b24e09f6a362c0d22fc3a2c7aebed/cmdline/status.c#L475

Because of this change:

TIMESTATUS=$($SNAPRAID_BIN -c $SNAPRAID_CONF status | grep 'You have [1-9][0-9]* files with zero sub-second timestamp\.' | sed 's/^You have/Found/g')

grep does not get the correct output because of the missing "a".
TIMESTATUS is empty.
"No zero sub-second timestamp files found."
Touch does not run, the number of files with a zero sub-second timestamp increases indefinitely.

Quick fix for anyone using snapraid 12.3, change the following line from:

TIMESTATUS=$($SNAPRAID_BIN -c $SNAPRAID_CONF status | grep 'You have [1-9][0-9]* files with zero sub-second timestamp\.' | sed 's/^You have/Found/g')

to:

TIMESTATUS=$($SNAPRAID_BIN -c $SNAPRAID_CONF status | grep 'You have [1-9][0-9]* files with a zero sub-second timestamp\.' | sed 's/^You have/Found/g')

In order to maintain compatibility with old snapraid versions, it should be possible to add a version query before the actual query to avoid errors.

@auanasgheps auanasgheps added the bug Something isn't working label Apr 8, 2024
@auanasgheps
Copy link
Owner

Hi, thank you for reporting. Still haven't updated to SnapRAID 12.3, so I didn't catch this.

Thankfully I don't have to check for the Snapraid version, because it does not always work.

I've done a quick fix and tested it locally. This code works by making a optional, so it works for both versions.

I will make the commit and hopefully do a fix release soon (can't promise).

TIMESTATUS=$($SNAPRAID_BIN -c $SNAPRAID_CONF status | grep -E 'You have [1-9][0-9]* files with( a)? zero sub-second timestamp\.' | sed 's/^You have/Found/g')

auanasgheps added a commit that referenced this issue Apr 8, 2024
SnapRAID 12.3 has changed the string of the diff ouput, causing the script not to catch it.
Now it works in both cases.
#92
@CIWXd
Copy link
Author

CIWXd commented Apr 8, 2024

Your quick fix is working, thanks!

@CIWXd CIWXd closed this as completed Apr 8, 2024
tehniemer added a commit to tehniemer/snapraid-aio-script that referenced this issue Apr 12, 2024
* Update script-config.sh

No more dev tag

* Update snapraid-aio-script.sh

URL to be checked is in master branch
No more dev tags

* Improve documentation of SYNC_WARN_THRESHOLD

Fixes auanasgheps#89 
Better explain what SYNC_WARN_THRESHOLD does, including Forced Sync option. This explanation was pretty old, in fact was never updated since I started working on the script.

* Update README.md

Small tweaks

* Fix touch not running on SnapRAID 12.3

SnapRAID 12.3 has changed the string of the diff ouput, causing the script not to catch it.
Now it works in both cases.
auanasgheps#92

* Update snapraid-aio-script.sh

* Install curl if check_updates is enabled

Check and install curl dependency if "CHECK_UPDATES" is enabled. auanasgheps#93

* Update version

Update for 3.3.1

* Update script version

Update version to 3.3.1

* Add Star History

* Update index

---------

Co-authored-by: Oliver Cervera <cervera93-19@yahoo.it>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants