dlandon Posted March 25 Author Share Posted March 25 3 hours ago, tuxbass said: Note data share doesn't show any modifications as of late. The activity above is expected to be under the backup share alone. Any idea as to why above activity is listed also for /mnt/user/data share? No, but looking into it. Quote Link to comment
tuxbass Posted April 1 Share Posted April 1 (edited) Looking at source, isn't the problematic bit caused by $share_dev = basename($share)."/"; $files = shell_exec("cat /var/log/file.activity.log 2>/dev/null | grep ".escapeshellarg($share_dev)." i.e. we take basename of a share (resulting in "data" in my case) and then grep it through activity log; as the backup share node has "/data/" in event file path, those events get erroneously included? On an unrelated note - in this particular case there's no real need to escapeshellarg - can use grep's --fixed-strings option instead. Also, that is a great example of useless use of cat, why not directly grep the file? Edited April 1 by tuxbass Quote Link to comment
dlandon Posted April 1 Author Share Posted April 1 4 hours ago, tuxbass said: i.e. we take basename of a share (resulting in "data" in my case) and then grep it through activity log; as the backup share node has "/data/" in event file path, those events get erroneously included? I have a fix for this. I just haven't released it yet. 4 hours ago, tuxbass said: On an unrelated note - in this particular case there's no real need to escapeshellarg - can use grep's --fixed-strings option instead. Also, that is a great example of useless use of cat, why not directly grep the file? Different styles. If you think you can do a better job, you are free to fork this project and do it yourself. Quote Link to comment
dlandon Posted April 1 Author Share Posted April 1 6 hours ago, tuxbass said: On an unrelated note - in this particular case there's no real need to escapeshellarg - can use grep's --fixed-strings option instead. Also, that is a great example of useless use of cat, why not directly grep the file? Just as a clarificaton. When AI is asked about which approach is better, the response is: "It depends on the size of the file /var/log/file.activity.log and the frequency of the script execution. If the file is relatively small and the script is not executed frequently, directly grepping the file would likely be more efficient and result in lower disk I/O. This is because reading the file directly with grep avoids the overhead of piping the output of cat into grep. However, if the file is large or the script is executed frequently, it may be more efficient to use a combination of cat and grep as you have done, especially if you're only interested in specific lines matching a pattern. This can help avoid repeatedly scanning the entire file with grep, potentially reducing overall disk I/O." The line of code in question is executed for every disk device and the log can get large (it is limited to 20,000 lines though), so based on the AI response, it appears the " useless use of cat" may not be useless after all. Maybe before criticizing the code, you need to understand it better? Quote Link to comment
tuxbass Posted April 1 Share Posted April 1 17 minutes ago, dlandon said: Just as a clarificaton. When AI is asked about which approach is better, the response is: "It depends on the size of the file /var/log/file.activity.log and the frequency of the script execution. If the file is relatively small and the script is not executed frequently, directly grepping the file would likely be more efficient and result in lower disk I/O. This is because reading the file directly with grep avoids the overhead of piping the output of cat into grep. However, if the file is large or the script is executed frequently, it may be more efficient to use a combination of cat and grep as you have done, especially if you're only interested in specific lines matching a pattern. This can help avoid repeatedly scanning the entire file with grep, potentially reducing overall disk I/O." The line of code in question is executed for every disk device and the log can get large (it is limited to 20,000 lines though), so based on the AI response, it appears the " useless use of cat" may not be useless afterall. Maybe before criticizing the code, you need to understand it better. Truly thought I might be helpful here tracking down the possible cause of the problem affecting me, and just mentioned the UUOC and a different grep option - I personally don't know everything and oftentimes learn from others in similar manner. Didn't realize I'm doing something awful here. In my professional developer career I haven't reached the place where I ask "AI" (whatever that means) how to solve problems, I'll try to improve, sorry. Also wasn't aware this thread is essentially /r/Conservative where people get hurt over literally nothing, am sorry again. And it's really cool to slide into people's DMs and vaguely threaten them with reporting their horrible posts like mine. Just wanted to reiterate it's completely OK and I invite everyone to report such content. Quote Link to comment
dlandon Posted April 1 Author Share Posted April 1 1 minute ago, tuxbass said: "AI" (whatever that means) Artificial Intelligence. If you aren't using it, do. It will do wonders for your coding. You can get a free ChatGPT account. Quote Link to comment
Bovin Posted April 3 Share Posted April 3 After upgrade from 6.11.X to 6.12.X, the disk spin up more frequently. I enable monitor, but I did not find any record during disk spin up timestamp. Any suggestion? Quote Link to comment
dopeytree Posted April 3 Share Posted April 3 (edited) Do you have: ZFS master plugin installed? swap to lazy load. Other monitoring containers like netdata etc? try unticking priveled mode when you edit the container settings. Bazarr doing subtitle searches on all media? Disk Location plugin? check the smart health check settings. Edited April 3 by dopeytree 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.