A.J. Venter wrote:

Any idea where I should start looking ?
Just a shot into the dark: maybe you start yout deamon, before your
local timezone is set up?

Does it change anything, when you move your bootscript to a higher
position in rc.x, e.g. make it S99whatever?
Good theory, but my daemon is very nearly the last bootscript to run, quite a long while after this system at least has set up the local timezone, ran ntpdate once and then started ntpd.

The log on a normal run shows each plugin getting run on zero, then again on whatever their interval dictates - but from bootup the only thing that shows up in the log are the tick's

Here are the critical parts of the source:

<snip>
Procedure ReadPlugins;
Var Plugins, ThisPlugin : TstringList;
           I,J : Integer;
        CMD,Min : String;
Begin
Writeln('Woled started');
Assign(fLog,logname);
Append(Flog);
Writeln(Flog,'Woled started');
Actions := TStringList.Create;
ThisPLugin := TstringList.Create;
GetDirList('/etc/wole/plugins/*',Plugins);
If Plugins.Count = 0 then
Begin
        Writeln(Flog,'No plugins configured, exciting');
        close(Flog);
        halt;
end;
For I := 0 to Plugins.Count -1 do
Begin
  ThisPlugin.Clear;
  ThisPlugin.LoadFromFile('/etc/wole/plugins/'+Plugins[I]);
  for J := 0 to ThisPlugin.Count -1 do
  Begin
        If pos('ACTION=',uppercase(ThisPlugin[J])) <> 0 then
        begin
         
CMD:=Copy(ThisPlugin[J],pos('=',ThisPlugin[J])+1,length(ThisPlugin[J]));
end; If pos('INTERVAL=',uppercase(ThisPlugin[J])) <> 0 then
        begin
         
Min:=Copy(ThisPlugin[J],pos('=',ThisPlugin[J])+1,length(ThisPlugin[J]));
        end;
  end;
  If (Length(Min) <> 0) And (Length(CMD) <> 0) then
  begin
        Actions.Add(min+'='+cmd);
  end else
  Begin
        Writeln(Flog,'Could not read ',Plugins[I],' format error.');
  end;
end;
Close(FloG);
ThisPlugin.Free;
Plugins.Free;
Writeln('Handling ',actions.count,' plugins');
end;

<snip>
begin{MAIN}
<snip>
{Inside the fork}
  Repeat
     If bHup Then Begin
        {$I-}
        Close(fLog);
        {$I+}
        IOResult;
        NewLog;
        bHup := false;
     End;
     {----------------------}
     Assign(Flog,Logname);
     Append(Flog);
        
     Writeln (Flog,'Tick - ',minutes,' minutes');       
     For PCount := 0 to Actions.Count -1 do
     Begin
        Mint := StrToInt(Copy(Actions[Pcount],1,pos('=',Actions[Pcount]) -1));
If Minutes mod Mint = 0 then Begin
        Writeln(Flog,'Executing plugin action:');
        
Writeln(Flog,'  
',copy(Actions[Pcount],pos('=',Actions[Pcount])+1,length(Actions[Pcount])));
        
shell(copy(Actions[Pcount],pos('=',Actions[Pcount])+1,length(Actions[Pcount]))); Writeln(Flog,'Action completed, resuming counter');
        end;
     end;
     Close(fLog);
     If bTerm Then
        BREAK
     Else
        { wait a while }
        fpSelect(0,nil,nil,nil,60000);
         inc(Minutes);
  Until bTerm;
  Actions.Free;


Just my 2 cents: If you're on linux look at the file rw permissions, especially for I/O-interfaces like ttyS0, ttyS1, etc. In Fedora they have only root write permissions.
Joep
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to