In these cases the "isServiceRunning" loop seems to be left immediately while the GBAK process on the server keeps running. Perhaps I am missing an option or so? This is my backup code, the restore code is analogous. I use a callback as I also use this code in a DLL for Inno Setup.
Code: Select all
procedure backupDB(srcServer, srcDatabase, srcSysdbaPW, aBackupfile, aPort, DLL: String; AcallBack: TUpdateCallBack);
var
IBCBackupService1: TIBCBackupService;
cnt: integer;
s: String;
begin
IBCBackupService1 := TIBCBackupService.create(nil);
cnt := 0;
try
with IBCBackupService1 do
begin
clientlibrary := DLL;
Database := srcDatabase;
Server := srcServer;
Username := 'sysdba';
Port := aPort;
Password := srcSysdbaPW;
Options := [];
BackupFile.Text := aBackupfile;
verbose := true;
Attach;
try
ServiceStart;
while IsServiceRunning do
begin
inc(cnt);
if cnt > PBMAX then
cnt := 10;
s := extractForLog(GetNextLine);
AcallBack(s, cnt, PBMAX);
end;
finally
detach;
end;
end;
finally
IBCBackupService1.free;
end;
end;