mysqldump and batch processing on windows (start /wait /B ....)
am 15.01.2007 23:55:55 von Frank Fischer
------=_NextPart_000_0007_01C73900.B3952DF0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
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
------=_NextPart_000_0007_01C73900.B3952DF0--
RE: mysqldump and batch processing on windows (start /wait /B ....)
am 16.01.2007 01:46:15 von Leigh Sharpe
What about using a batch file to do the backups instead? You don't need t=
he 'start' command from within a batch file. That way each command will w=
ait until the previous one finishes.
Alternatively, try using a perl script and invoke the mysqldump facility w=
ith backticks. Something like this:
------
#!c:\perl\bin\perl
Use strict;
Use warnings;
My @output=3D`d:\mysql-slave\bin\mysqldump --host=3D127.0.0.1 --port=3D33=
06 --user=3Dxxxx --password=3Dxxxx --all-databases --verbose --compress`;=
=20
Open (OUTPUT,">backupfile3306.sql") or die "Couldn't open file: $!\n";
Print OUTPUT "@output";
Close OUTPUT or die "Couldn't close file after writing: $!\n";
My @output=3D`d:\mysql-slave\bin\mysqldump --host=3D127.0.0.1 --port=3D33=
07 --user=3Dxxxx --password=3Dxxxx --all-databases --verbose --compress`;=
=20
Open (OUTPUT,">backupfile3307.sql") or die "Couldn't open file: $!\n";
Print OUTPUT "@output";
Close OUTPUT or die "Couldn't close file after writing: $!\n";
My @output=3D`d:\mysql-slave\bin\mysqldump --host=3D127.0.0.1 --port=3D33=
08 --user=3Dxxxx --password=3Dxxxx --all-databases --verbose --compress`;=
=20
Open (OUTPUT,">backupfile3308.sql") or die "Couldn't open file: $!\n";
Print OUTPUT "@output";
Close OUTPUT or die "Couldn't close file after writing: $!\n";
My @output=3D`d:\mysql-slave\bin\mysqldump --host=3D127.0.0.1 --port=3D33=
09 --user=3Dxxxx --password=3Dxxxx --all-databases --verbose --compress`;=
=20
Open (OUTPUT,">backupfile3309.sql") or die "Couldn't open file: $!\n";
Print OUTPUT "@output";
Close OUTPUT or die "Couldn't close file after writing: $!\n";
Print "All done.\n";
---------
Regards,
Leigh
=20
Leigh Sharpe
Network Systems Engineer
Pacific Wireless
Ph +61 3 9584 8966
Mob 0408 009 502
email lsharpe@pacificwireless.com.au
web www.pacificwireless.com.au
-----Original Message-----
From: Frank Fischer [mailto:frank.fischer@digitalnomads.ch]=20
Sent: Tuesday, January 16, 2007 9:56 AM
To: win32@lists.mysql.com
Subject: mysqldump and batch processing on windows (start /wait /B ....)
Hi all
=20
i have a little problem with mysqldump under Windows 2k3.=20
=20
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 d=
ump
just starts after the first dump has finished and so on (at least i see n=
o
other way to do this). Otherwise all dumps would run at the same time.
=20
Funny thing is - that only works when calling mysqldump as follows:
=20
start /wait /low d:\mysql-slave\bin\mysqldump --host=3D127.0.0.1 --port=3D=
3306
--user=3Dxxxx --password=3Dxxxx --all-databases --verbose --compress >
backupfile3306.sql
start /wait /low d:\mysql-slave\bin\mysqldump --host=3D127.0.0.1 --port=3D=
3307
--user=3Dxxxx --password=3Dxxxx --all-databases --verbose --compress >
backupfile3307.sql
start /wait /low d:\mysql-slave\bin\mysqldump --host=3D127.0.0.1 --port=3D=
3308
--user=3Dxxxx --password=3Dxxxx --all-databases --verbose --compress >
backupfile3308.sql
start /wait /low d:\mysql-slave\bin\mysqldump --host=3D127.0.0.1 --port=3D=
3309
--user=3Dxxxx --password=3Dxxxx --all-databases --verbose --compress >
backupfile3309.sql
=20
=20
Now - like this each mysqldump runs after another, but, unfortunally no d=
ata
is written to the target files. What i see, is that a new console window i=
s
opened and the backup data is written to this window instead of to the fi=
le.
=20
So i changed the batch commands a little bit. I just added "/B" to the st=
art
command:
=20
start /wait /low /B d:\mysql-slave\bin\mysqldump --host=3D127.0.0.1
--port=3D3306 --user=3Dxxxx --password=3Dxxxx --all-databases --verbose -=
-compress
> backupfile3306.sql
start /wait /low /B d:\mysql-slave\bin\mysqldump --host=3D127.0.0.1
--port=3D3307 --user=3Dxxxx --password=3Dxxxx --all-databases --verbose -=
-compress
> backupfile3307.sql
start /wait /low /B d:\mysql-slave\bin\mysqldump --host=3D127.0.0.1
--port=3D3308 --user=3Dxxxx --password=3Dxxxx --all-databases --verbose -=
-compress
> backupfile3308.sql
start /wait /low /B d:\mysql-slave\bin\mysqldump --host=3D127.0.0.1
--port=3D3309 --user=3Dxxxx --password=3Dxxxx --all-databases --verbose -=
-compress
> backupfile3309.sql
=20
=20
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 instea=
d
of waiting until a mysqldump process has ended before starting the next, t=
he
batch just starts one after another so all are running at the same time.=20
=20
Working with CALL instead of START or even with CALL in combination with
START doesn't change anything in this behaviour.=20
=20
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)?
=20
Thanks a lot for your help
Frank
=20
=20
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org