Subject Re: [firebird-support] Running gbak from CreateProcess or ShellExecute
Author Helen Borrie
At 10:05 AM 26/10/2004 +1300, Tom Munro Glass wrote:

>I need to run gbak on a remote Firebird server from a Delphi application. I
>have tried using CreateProcess and ShellExecute but both of these methods are
>giving a really strange problem. The backup works except that the backup
>filename ends up with a spurious character on the end of it, e.g.
>007222_SiteData4_DL1.fbkº
>
>Below is the command I am trying to execute (note this is normally all one
>line)
>
>"C:\Program Files\Firebird\bin\gbak.exe" -backup -verbose -service
>kingfisher:service_mgr -user SYSDBA -password masterkey
>"D:\SiteData\007222\007222_SiteData4.fdb"
>"D:\SiteData\007222\Backup\007222_SiteData4_DL1.fbk"
>
>If I execute this with CreateProcess or ShellExecute, I get the same problem.
>If I type this into a Win2K command prompt, it works correctly. I have also
>put this exact text into a batch file, testgbak.bat. If I execute
>testgbak.bat from a command prompt, it works, but if I execute testgbak.bat
>from CreateProcess or ShellExecute the extra character is appended.
>
>I have tried with and without double-quotes around the filenames, and it
>makes
>no difference. I have also tried this with two different Firebird servers,
>one running on Win2K and the other running on FreeBSD 4.10, with exactly the
>same results on both.
>
>The first two lines of output from gbak are:
>
>gbak: readied database D:\SiteData\007222\007222_SiteData4.fdb for backup
>gbak: creating file D:\SiteData\007222\Backup\007222_SiteData4_DL1.fbkº
>
>I'm using Firebird 1.5.1 on both the client and servers.
>
>Can anyone please explain this?

It could be something as simple as CreateProcess having nowhere to put the
verbose output. Try adding the switch
-y D:\SiteData\007222\Backup\007222_SiteData4_DL1.log

to the end of the whole command and see whether that fixes it.

btw, you just caused me to discover an error in the gbak switches list in
The Book. the -v switch abbreviates -verify, not -verbose. But gbak
doesn't mind, it seems to ignore everything after the "v". I'd suggest
either correcting "-verbose" to "-verify" anyway. Though it's a far call,
you never know but what someone might decide to add another switch like
"-verbs_only" at some future point.

./heLen