_Shorty
Members
-
Joined
-
Last visited
Solutions
-
_Shorty's post in Problem with Scheduled Trim of CCTV drive and Frigate Container was marked as the answerif (is_hdd($source)) continue; fwrite($myfile,"$source Is HDD\n\r"); ### Result of HDD Check
The "continue" command actually means "bail out here and don't execute any of the remaining commands in this side branch, and instead, continue back on the branch that called it." So your fwrite is being executed only when a hard drive is NOT found. Since you do not see your added line of text output when it looks at /dev/sde1 this tells you that it is indeed bailing out at that continue command. What I find interesting about your list of processes that are running is the fstrim command is not the same as what's in the section of script code we're looking at. The command listed there in the processes list is "fstrim -va", which means trim all drives. I wonder where it is getting that command from, since the one we've been looking at doesn't have -va, but only -v. Ah yes, right at the very start of the script.
// cron operation if ($argc==2 && $argv[1]=='cron') { // trim btrfs, xfs echo shell_exec("fstrim -va 2>/dev/null"); // trim zfs zfs_trim(false); exit(0); }
This checks if it is running as a cron job, and if it is then it runs "fstrim -va 2>/dev/null" which trims ALL drives, and "zfs_trim(false);" to trim zfs pools, and then exits without running the rest of the script. So the remainder of the code where it checks for which drive types there are, and only trims SSDs, never gets executed. The two slashes "//" at the start of those lines are an indication that whatever else follows on that line is just commentary and is ignored as far as execution goes. So if you just add two slashes to the start of the echo line and the exit line it should start behaving.
// cron operation if ($argc==2 && $argv[1]=='cron') { // trim btrfs, xfs // echo shell_exec("fstrim -va 2>/dev/null"); // trim zfs zfs_trim(false); // exit(0); }
That will stop it from running fstrim on all drives here, and will also stop it from exiting here so that the remainder of the code will run. I think that'll do the trick.