I believe I have found a viable solution.
My Perl skills are not strong and it's been a while since I've coded anything in Perl, so if I messed up the code please let me know.
After analyzing the script, I determined that the variable $CheckTime was not the problem. The code before the test statement always had a clause for every possible outcome for $CheckTime. I could not find a hole anywhere.
Which lead me to @FileStat.
Again, it's been a while since I've coded in Perl, but it looks like that @FileStat is populated with the stat function and I'm guessing that function takes as an input a filename (indicated by the variable used "$Archive").
I think I can safely surmise that in this case, the file referenced by $Archive does not exist and therefore @FileStat does not get properly initialized and populated by the code "stat($Archive);", leading to that very daily annoying inbox message.
My solution is to initialize the offending variable if the variable is uninitialized.
Normally, I hate modifying someone else's code. I don't know their intent, thinking process, structure, or way of doing things and I'm always afraid of stomping on their territory. I know I wouldn't like it if someone else started messing with my window apps. So in case the original author of the script reads what I did to his/her code:
I apologize, I only did it because I don't know what else to do.
The fix I've come up with is to modify the code above the line where the error is generated: if ($CheckTime <= ($FileStat[9])) {...
Code:
my @FileStat = stat($Archive);if (!defined($FileStat[9])){$FileStat[9]=0;};
The new code checks whether or not $FileStat[9] is initialized and if it isn't, initializes it with an integer zero. I have coded it to check to see if the variable isn't initialized first so that I don't (hopefully) break the original intent of the script in case the file referenced by $Archive does someday come into existence for whatever reason.
I intentionally placed the code on the same line as that of the stat($Archive) line so that if I ever have another problem with the script, the line numbers won't get shifted around and I can still use the line number with the warning/error message when I research it online.
The cron error emails have stopped since implementing this makeshift fix and I have yet to see any abnormal side effects.
thanks in advance for any comments.
------Edit------
I toyed with the script a bit more to find out why it was happening in the first place. I discovered that the script was trying to "stat" a broken symbolic link. Oh well, I deleted the link. No side effects as of yet.
Recent comments
17 hours 14 min ago
23 hours 55 min ago
1 day 3 hours ago
1 day 5 hours ago
1 day 13 hours ago
1 day 23 hours ago
2 days 7 min ago
2 days 3 hours ago
2 days 8 hours ago
2 days 8 hours ago