On Tue, 21 Nov 2006, TOUZEAU DAVID wrote:
> Dear
>
> my application run has a daemon
> When the daemon load, it create a Timer function as a class(TThread).
> This Timer thread has a loop and create an another Thread (called "SendStatus"
> each 5 minutes)
>
> function that load thread :
> ###
> procedure mTimer.Execute;
> var
> Pool:integer;
> xPool:longint;
> Myini:TIniFile;
> thread:SendStatus;
> begin
>
> while not Terminated do
> begin
> FConfigFilePath:='/etc/artica/artica-agent.conf';
> LoadSettings;
> xPool:=(Fpool*60)*1000;
> logs('mTimer.Execute->initilize pooling for ' + IntTostr(Fpool) + '
> milliseconds for each loop-> '+ IntTostr(Fpool) + ' minutes (from ' +
> FConfigFilePath + ')');
> LoadSettings;
> logs('mTimer.Execute->initilize Thread Sendstatus');
> thread:=SendStatus.Create; //Creating the new thread
> thread.Resume;//Executing the new thread
> thread.free;//Terminate the new thread
> logs('mTimer.Execute->kill Thread Sendstatus');
>
> if FMustReload=1 then begin
>Myini:=TIniFile.Create(FConfigFilePath);
>Myini.WriteInteger('ACTIONS','ReloadSettings',1);
>LoadSettings;
> xPool:=(Fpool*60)*1000;
> logs('mTimer.Execute->Reload settings -> initilize pooling for
> ' + IntTostr(xPool) + ' milliseconds for each loop');
>MyIni.free;
> end;
> Sleep(xPool);
>
> end;
> end;
> ###
>
>
> The "SendStatus" execute sometimes an external program writen in fpc called
> "articacrypt".
>
> the function just use Execl to execute external program
> ###
> procedure
> SendStatus.DeCryptFile(Frompath:string;ToPath:string;PassPharse:string;SETT:KLNetSettings);
> var passphrase,commandline,Fbin_path:string;
>begin
>Fbin_path:=SETT.binaries_path;
>if Length(SETT.artica_crypt_key)=0 then begin
> SETT.logs('SendStatus.artica_crypt_key -> null aborting..');
> exit;
>end;
>commandline:=Fbin_path + '/articacrypt false ' + Frompath + ' ' +
> ToPath + ' ' + PassPharse;
>
>Execl(commandline);
>
>SETT.logs('SendStatus.DeCryptFile -> ' + ToPath + ' was process');
>exit;
> end;
> ###
>
> this external program kill itself by calling halt() function at the end of the
> code.
>
>
>
> My problem is that each execution of this program will add in the
> Linux system :
>
> example of ps -aux :
>
> root 25992 0.0 0.1 20500 2292 pts/0Sl 19:45 0:00
> /opt/artica/bin/articaagentd
> root 26008 0.0 0.0 0 0 pts/0Z19:45 0:00 [articacrypt]
>
> root 26009 0.0 0.0 0 0 pts/0Z19:45 0:00 [articacrypt]
>
> root 26010 0.0 0.0 0 0 pts/0Z19:45 0:00 [articacrypt]
>
> root 26011 0.0 0.0 0 0 pts/0Z19:45 0:00 [articacrypt]
>
> root 26012 0.0 0.0 0 0 pts/0Z19:45 0:00 [articacrypt]
>
> root 26134 0.0 0.0 0 0 pts/0Z19:47 0:00 [articacrypt]
>
> root 26135 0.0 0.0 0 0 pts/0Z19:47 0:00 [articacrypt]
>
> root 26136 0.0 0.0 0 0 pts/0Z19:47 0:00 [articacrypt]
>
> root 26137 0.0 0.0 0 0 pts/0Z19:47 0:00 [articacrypt]
>
> root 26138 0.0 0.0 0 0 pts/0Z19:47 0:00 [articacrypt]
>
> root 26247 0.0 0.0 0 0 pts/0Z19:49 0:00 [articacrypt]
>
> root 26248 0.0 0.0 0 0 pts/0Z19:49 0:00 [articacrypt]
>
> root 26249 0.0 0.0 0 0 pts/0Z19:49 0:00 [articacrypt]
>
> root 26250 0.0 0.0 0 0 pts/0Z19:49 0:00 [articacrypt]
>
> root 26251 0.0 0.0 0 0 pts/0Z19:49 0:00 [articacrypt]
>
> root 26388 0.0 0.0 0 0 pts/0Z19:51 0:00 [articacrypt]
>
> root 26389 0.0 0.0 0 0 pts/0Z19:51 0:00 [articacrypt]
>
> root 26390 0.0 0.0 0 0 pts/0Z19:51 0:00 [articacrypt]
>
> root 26391 0.0 0.0 0 0 pts/0Z19:51 0:00 [articacrypt]
>
> root 26392 0.0 0.0 0 0 pts/0Z19:51 0:00 [articacrypt]
>
> root 26511 0.0 0.0 0 0 pts/0Z19:53 0:00 [articacrypt]
>
> root 26512 0.0 0.0 0 0 pts/0Z19:53 0:00 [articacrypt]
>
> root 26513 0.0 0.0 0 0 pts/0Z19:53 0:00 [articacrypt]
>
> root 26514 0.0 0.0 0 0 pts/0Z19:53 0:00 [articacrypt]
>
> root 26515 0.0 0.0 0 0 pts/0Z19:53 0:00 [articacrypt]
>
> root 26662 0.0 0.0 0 0 pts/0Z19:55 0:00 [articacrypt]
>
> root 26663 0.0 0.0 0 0 pts/0Z19:55 0:00 [articacrypt]
>
> root 26664 0