Touch not running after update to snapraid 12.3
Closed this issue · 2 comments
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:
snapraid-aio-script/snapraid-aio-script.sh
Line 567 in ecbaa73
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.
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')
Your quick fix is working, thanks!