Windows Batch file problems

MichaelCupit

New Member
Hi All,

I've been lurking here for a while, and now I'm making my first post. :)

I've started a new position and have been charged with cleaning up the batch files that run the backups for the various databases. We are using 9.1e on Windows 2000 and Windows 2003 servers (I miss Linux already).

I've created a sports2000 database and a batch script to backup the database. At the end of each line, I use ">>" to send the output to a log file. It seems that the line that starts the database (proserve) takes ownership of the log file, so that the next time I run the batch script, the shutdown line (proshut) fails. I can't delete the log file.

Often it seems to shutdown the database, but leave the .lk file around. I can't delete that file either as the _mprosrv process both exists and has ownership of that file even though the database has been shut down.

If I remove the >> logfile.txt part of the proserve line, everything runs fine. I just don't get any info on the startup in the log file. If you have any ideas (or a reason that my boss would accept to switch to Linux :rolleyes:) I'd love to hear it.

I've put the script below.

Thanks
Michael


del /Q c:\sportsmikec.db >> detlog.txt
cmd /C "d:\progress\9.1e\bin\proshut d:\spomikec\sportsmikec -by >> detlog.txt"
cmd /C "d:\progress\9.1e\bin\probkup c:\spomikec\sportsmikec c:\sportsmikec.db >> detlog.txt"
cmd /C "d:\progress\9.1e\bin\proutil d:\spomikec\sportsmikec -C truncate bi >> detlog.txt"
cmd /C "d:\progress\9.1e\bin\proserve d:\spomikec\sportsmikec" >> detlog.txt"
cmd /C "xcopy /Y /S /C /Q /H c:\sportsmikec.db d:\spomikec\backup_sports.db >> detlog.txt"
 

RealHeavyDude

Well-Known Member
I am not a Windoze scripting guru - but did anyone try to replace the cmd with call? All my Windoze scripts use call, I never used cmd.

Heavy Regards, RealHeavyDude.
 

TomBascom

Curmudgeon
CALL is still quite useful -- it ensures that running something which is another BAT file returns to the CALLer.

You might have better luck using START. I usually do something like:

START /min "Description" file.bat

Then, in "file.bat":

progressCommand arguments > logFile
exit
 
Top