|
Will check if the specified file is in locked state (e.g. opened by another process) |
|
PathToFile |
The path (from HansaWorld root) and name of the file that is being checked. |
|
updating
procedure UpdateServerStatus(var record LocalManagedServerVc LMSr,var record HansaVersionVc HVr)
begin
LongInt svpid;
record LocalManagedServerVc OldLMSr;
string 255 dbname;
string 255 hallogfile;
RecordCopy(OldLMSr,LMSr);
LMSr.StatusText = "";
// ## check that HDB exists
// ## check that all versions are valid, implement status on version records
if (GetVersion(LMSr.HansaVersion,HVr)==false) then begin
LMSr.CurrentStatus = kStatusConfigInError;
LMSr.StatusText = "version missing";
LogText(0,"UpdateServerStatus: version missing");
goto LUpdateServerStatus;
end;
hallogfile = LMSr.DataFolder & "hal.log";
if (FileExists(hallogfile)) then begin
LMSr.CurrentStatus = kStatusConfigInError;
LMSr.StatusText = "halcust errors";
LogText(0,"UpdateServerStatus: halcust errors");
goto LUpdateServerStatus;
end;
dbname = HDBFile(LMSr,HVr);
if (FileExists(dbname)==false) then begin
LMSr.CurrentStatus = kStatusConfigInError;
LMSr.StatusText = "HDB missing";
LogText(0,"UpdateServerStatus: HDB missing");
goto LUpdateServerStatus;
end;
if (FileIsLocked(dbname)==false) then begin
LMSr.CurrentStatus = kStatusStopped;
LogText(0,"UpdateServerStatus: server is stopped (HDB File not locked)");
goto LUpdateServerStatus;
end;
if (FileExists(PidFile(LMSr))==false) then begin
LMSr.CurrentStatus = kStatusConfigInError;
LMSr.StatusText = "pidfile missing";
LogText(0,"UpdateServerStatus: pidfile missing");
goto LUpdateServerStatus;
end;
svpid = ReadLongFromFile(PidFile(LMSr));
if (PidIsRunning(svpid)==false) then begin
LogText(0,"UpdateServerStatus: 2");
LMSr.CurrentStatus = kStatusConfigInError;
LMSr.StatusText = "pid missing, but HDB locked";
LogText(0,"UpdateServerStatus: pid missing, but HDB locked");
goto LUpdateServerStatus;
end;
LMSr.CurrentStatus = kStatusRunning;
//LogText(0,"UpdateServerStatus: server is running");
// ## SendManagementRequest( ... );
LUpdateServerStatus:;
if (RecordUpdate(OldLMSr,LMSr,false)==0) then begin end;
return;
end;
|
««