Create a full backup copy of the server's databases immediately. The format of the backup file archive is ZIP.

 

Syntax

function mMakeBackupServerDataBase(sFileNameWithPath: string): string;

 

Parameters and return values

Parameter

Type

Value

sPath

string

full path to a folder for backup.

 

If a path is not specified, a backup copy will be written  to the folder "C:\ProgramData\MyChat Server\backup\" (if the server installed to the folder "MyChat Server").

Function result

Text string with full name and path to the backup ZIP archive. The archive is created in a folder that is specified in the server settings. File name — current date/time and the server's time in the format "mcservdb-yyyy-mm-dd-hh-nn-ss.zip".

 

Example


var
  dtStart: double;
  sFileName: string;
begin
  SetScriptTimeOut(100000);
  dtStart := Now;
  mLogScript('Backup started...', '');
  
  sFileName := mMakeBackupServerDataBase('');
  
  mLogScript('Backup finished, elapsed time is '
             IntToStr(SecondsBetween(Now, dtStart)) +
             ' seconds.', '');
  mLogScript('File name: "' + sFileName + '"', ''); 
  mLogScript('File size: ' + IntToKbyte(FileSize(sFileName)), '');
end.


Script work result

[18:45:26] (Log "mMakeBackupServerDataBase"): Backup started...

[18:45:43] (Log "mMakeBackupServerDataBase"): Backup finished, elapsed time is 16 seconds.

[18:45:43] (Log "mMakeBackupServerDataBase"): File name: "C:\Documents and Settings\All Users\Application Data\MyChat Server\backup\mcservdb-2018-12-08-18-45.zip"

[18:45:43] (Log "mMakeBackupServerDataBase"): File size: 45.1 MB

[18:45:43] (Run "mMakeBackupServerDataBase"): Script operation time: 16713 мс

[18:45:43] (Run "mMakeBackupServerDataBase"): Script done successfully.

 

See also

FileSize

IntToKbyte

IntToStr

mLogScript

SetScriptTimeOut