monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [monit-dev] Unable to read magic


From: Martin Pala
Subject: Re: [monit-dev] Unable to read magic
Date: Mon, 4 Feb 2013 23:06:38 +0100

The fix:

Index: src/state.c
===================================================================
--- src/state.c (revision 5699)
+++ src/state.c (revision 5700)
@@ -239,6 +239,9 @@
 
 
 void State_update() {
+        /* Ignore empty state file */
+        if ((lseek(file, 0L, SEEK_END) == 0))
+             return;
         TRY
         {
                 if (lseek(file, 0L, SEEK_SET) == -1)


On Feb 4, 2013, at 10:58 PM, Martin Pala <address@hidden> wrote:

> Hi,
> 
> yet one note - the error is logged also when monit starts for the first time 
> (this is minor bug, we'll fix) ... the error can be ignored, monit works 
> normally even if the state wasn't read.
> 
> Regards,
> Martin
> 
> 
> On Feb 4, 2013, at 9:40 PM, Martin Pala <address@hidden> wrote:
> 
>> Hi Sergey,
>> 
>> the magic is used to differentiate old state file format (which started with 
>> number of services) from the new extensible state file format (starts with 
>> 0, which is the "magic" - older monit versions will always start with number 
>> > 0).
>> 
>> It seems that the user's statefile is probably empty, hence the error is 
>> returned.
>> 
>> The solution is simple:
>> 
>> 1.) stop monit
>> 2.) remove the state file: rm -f /var/lib/monit/state
>> 3.) start monit (will create new state file)
>> 
>> Regards,
>> Martin
>> 
>> 
>> 
>> On Feb 4, 2013, at 8:05 PM, Sergey B Kirpichev <address@hidden> wrote:
>> 
>>> At the first startup of monit (just installed) users see:
>>> [EDT Jun 24 21:26:20] error : State file '/var/lib/monit/state': Unable to 
>>> read magic
>>> 
>>> Example:
>>> https://bugs.launchpad.net/ubuntu/+source/monit/+bug/1017327
>>> 
>>> That's normal?  Is there any way to prevent this "confusing" message
>>> for this case?
>>> 
>>> _______________________________________________
>>> monit-dev mailing list
>>> address@hidden
>>> https://lists.nongnu.org/mailman/listinfo/monit-dev
>> 
> 
> 
> _______________________________________________
> monit-dev mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/monit-dev




reply via email to

[Prev in Thread] Current Thread [Next in Thread]