Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 14th March 2006, 16:13
kisong kisong is offline
Member
 
Join Date: Oct 2005
Posts: 63
Thanks: 0
Thanked 1 Time in 1 Post
Default Cron.daily Use of uninitialized value ERROR

Every day, I get this error e-mail sent to my root account:

/etc/cron.daily/0logwatch:

Use of uninitialized value in numeric le (<=) at /etc/cron.daily/0logwatch line 683.
Use of uninitialized value in numeric le (<=) at /etc/cron.daily/0logwatch line 683.
Use of uninitialized value in numeric le (<=) at /etc/cron.daily/0logwatch line 683.
Use of uninitialized value in numeric le (<=) at /etc/cron.daily/0logwatch line 683.

What could be causing this error EVERY DAY?
Reply With Quote
Sponsored Links
  #2  
Old 14th March 2006, 17:50
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,743 Times in 2,577 Posts
Default

Please check line 683 of /etc/cron.daily/0logwatch.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 14th March 2006, 17:59
kisong kisong is offline
Member
 
Join Date: Oct 2005
Posts: 63
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by falko
Please check line 683 of /etc/cron.daily/0logwatch.
This is line 683:

if ($CheckTime <= ($FileStat[9])) {
Reply With Quote
  #4  
Old 14th March 2006, 18:35
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,743 Times in 2,577 Posts
Default

One of these two variables hasn't been initialized before.

This is just a warning, you can ignore it.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 14th March 2006, 20:00
kisong kisong is offline
Member
 
Join Date: Oct 2005
Posts: 63
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by falko
One of these two variables hasn't been initialized before.

This is just a warning, you can ignore it.
How can I initialize this variable?

This error happens EVERY DAY!
Reply With Quote
  #6  
Old 15th March 2006, 08:11
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,381
Thanks: 833
Thanked 5,482 Times in 4,316 Posts
Default

Quote:
Originally Posted by kisong
How can I initialize this variable?
Therefor you will have to read / analyze the script and try to find out which variable is not cleanly initialized.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #7  
Old 29th November 2007, 16:25
thinktink thinktink is offline
Junior Member
 
Join Date: Nov 2007
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
 
Default Makeshift fix: Cron.daily Use of uninitialized value ERROR

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.

Last edited by thinktink; 30th November 2007 at 05:45.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR: The PHP binary coming with ISPConfig does not work properly on your system! qvindesland Installation/Configuration 22 21st May 2007 16:05
Fresh Install on Debian cksrealm Installation/Configuration 12 22nd February 2006 16:14
Installation Fails... :( cyberstorm Installation/Configuration 1 15th January 2006 18:07
Could not make OpenSSL yontengyatso Installation/Configuration 3 3rd November 2005 10:50
Install stop at uuwish, UUDeview SeaWolf Installation/Configuration 6 4th October 2005 23:53


All times are GMT +2. The time now is 04:15.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.