MySQL-backups send out percent messages ;D

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
nakkeli
Forum Newbie
Posts: 15
Joined: Thu Apr 10, 2008 1:18 am

MySQL-backups send out percent messages ;D

Post by nakkeli »

I've been trying to create a MySQL-backup script which I could run using cron and get daily backups to my email. Everything is working perfectly, but when I run this using cron, it sends out percent values. At first I though it was gzip, and added the switch -q into gzip command to make it quiet, but no, it's not that. Could comeone tell how to disable these messages so cron would not send me emails about percents?

Code:

Code: Select all

 
$command = 'mysqldump --opt -u ' . $databases[$key]['dbuser'] . ' -p' . $databases[$key]['dbpass'] .
    ' ' . $databases[$key]['dbname'] . ' | gzip -q -v -9 > ' . $filename;
 
system($command);
 
That's the main part of my script. I use phpMailer to send out the mails.
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: MySQL-backups send out percent messages ;D

Post by ghurtado »

nakkeli wrote: but when I run this using cron, it sends out percent values.
I have no idea what you mean by "it sends out percent values"
User avatar
nakkeli
Forum Newbie
Posts: 15
Joined: Thu Apr 10, 2008 1:18 am

Re: MySQL-backups send out percent messages ;D

Post by nakkeli »

Well, cron just sends out these kind of messages:

66.9%
66.0%
84.7%
81.4%
64.5%

And that's from a script which backups 5 different databases.
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: MySQL-backups send out percent messages ;D

Post by ghurtado »

That's very odd. I would also have guessed the problem to be gzip, but you already discarded that possibility.

Are there any echos or prints in the rest of your script?
User avatar
nakkeli
Forum Newbie
Posts: 15
Joined: Thu Apr 10, 2008 1:18 am

Re: MySQL-backups send out percent messages ;D

Post by nakkeli »

Only one, echo only if sending the email fails.
User avatar
nakkeli
Forum Newbie
Posts: 15
Joined: Thu Apr 10, 2008 1:18 am

Re: MySQL-backups send out percent messages ;D

Post by nakkeli »

I think I got it:

Code: Select all

 
gzip -q -9 > ' . $filename;
 
"-9" is the best compression option, I thought first (for some reason) it's "-v -9", "-v" is verbose mode...
Post Reply