mysqldump and batch processing on windows (start /wait /B ....)

"Frank Fischer" <[email protected]> Mon, 15 Jan 2007 23:55:55 +0100
Newsgroups gmane.comp.db.mysql.windows
Message-ID <[email protected]>
Hi all
 
i have a little problem with mysqldump under Windows 2k3. 
 
I have four instances of mysql running which i would like to backup, one
after the other. That means, i would have to start mysqldump app with the
windows "START" command with the "/wait" option to make sure the second dump
just starts after the first dump has finished and so on (at least i see no
other way to do this). Otherwise all dumps would run at the same time.
 
Funny thing is - that only works when calling mysqldump as follows:
 
start /wait /low d:\mysql-slave\bin\mysqldump --host=127.0.0.1 --port=3306
--user=xxxx --password=xxxx --all-databases --verbose --compress >
backupfile3306.sql
start /wait /low d:\mysql-slave\bin\mysqldump --host=127.0.0.1 --port=3307
--user=xxxx --password=xxxx --all-databases --verbose --compress >
backupfile3307.sql
start /wait /low d:\mysql-slave\bin\mysqldump --host=127.0.0.1 --port=3308
--user=xxxx --password=xxxx --all-databases --verbose --compress >
backupfile3308.sql
start /wait /low d:\mysql-slave\bin\mysqldump --host=127.0.0.1 --port=3309
--user=xxxx --password=xxxx --all-databases --verbose --compress >
backupfile3309.sql
 
 
Now - like this each mysqldump runs after another, but, unfortunally no data
is written to the target files. What i see, is that a new console window is
opened and the backup data is written to this window instead of to the file.

 
So i changed the batch commands a little bit. I just added "/B" to the start
command:
 
start /wait /low /B d:\mysql-slave\bin\mysqldump --host=127.0.0.1
--port=3306 --user=xxxx --password=xxxx --all-databases --verbose --compress
> backupfile3306.sql
start /wait /low /B d:\mysql-slave\bin\mysqldump --host=127.0.0.1
--port=3307 --user=xxxx --password=xxxx --all-databases --verbose --compress
> backupfile3307.sql
start /wait /low /B d:\mysql-slave\bin\mysqldump --host=127.0.0.1
--port=3308 --user=xxxx --password=xxxx --all-databases --verbose --compress
> backupfile3308.sql
start /wait /low /B d:\mysql-slave\bin\mysqldump --host=127.0.0.1
--port=3309 --user=xxxx --password=xxxx --all-databases --verbose --compress
> backupfile3309.sql
 
 
Now again a funny behaviour - this time there are no new console windows
opened and the backup data is written to the target files, but now instead
of waiting until a mysqldump process has ended before starting the next, the
batch just starts one after another so all are running at the same time. 
 
Working with CALL instead of START or even with CALL in combination with
START doesn't change anything in this behaviour. 
 
Does anyone has an idea what i'm doing wrong? Any other way to do what i
would like (i have to add that i also need to control process priority)?
 
Thanks a lot for your help
Frank