PDA

View Full Version : Cron Backups Stopped Working on MySQL03


Tresclub
10-6-05, 12:49 PM
Mt cron job has been flawlessly creating backups every morning for some time, and on the morning of Oct 4th, it decided to stop working. Nothing changed on my end (that I am aware of).

This is my cron file:

28 3 * * * /usr/local/bin/php $HOME/htdocs/mysql03_backup.php >>$HOME/logs/cron.log 2>>$HOME/logs/cron.err

This is from the cron.err log:

Failed loading /usr/local/Zend/lib/ZendExtensionManager.so: Cannot open "/usr/local/Zend/lib/ZendExtensionManager.so"
Failed loading /usr/local/Zend/lib/ZendExtensionManager.so: Cannot open "/usr/local/Zend/lib/ZendExtensionManager.so"
/usr/local/bin/mysqldump: Got errno 70 on write
/usr/local/bin/mysqldump: Got errno 70 on write
/usr/local/bin/mysqldump: Got errno 70 on write
/usr/local/bin/mysqldump: Got errno 70 on write
/usr/local/bin/mysqldump: Got errno 70 on write
PHP Warning: Zend Optimizer for PHP 4.3.x cannot be found (expected at '/usr/local/Zend/lib/Optimizer-2.5.10/php-4.3.x/ZendOptimizer.so') - try reinstalling the Zend Optimizer in Unknown on line 0
/usr/libexec/ld-elf.so.1: Shared object "libexpat.so.4" not found

Anyone have any ideas as to what would have caused it to stop working?

RTH10260
10-6-05, 01:15 PM
/usr/libexec/ld-elf.so.1: Shared object "libexpat.so.4" not foundThis is the second time I see this error message mentioned to day.

Please submit a problem ticket to Support@powweb.com or thru OPS. You may also want to contact staff thru Chat to get this issue escalated.

extras
10-6-05, 01:18 PM
Possibly, it's caused by the setup of syslog server (which executes cronjobs).

You have two options (and maybe more...)
#1 File a ticket with the same info, and wait.
It may take a while because there could be many support tickets right now and it requires admin intervention.

#2 Stop using PHP for doing MySQL backup, as it's a wastful thing to do in many cases.
If you choose this option, please show me the php script (hiding sensitive info), and I'll show you the better way.
By eliminating the middle-man (PHP), there will be less risk of failure, in future, too.

Tresclub
10-6-05, 01:40 PM
#2 Stop using PHP for doing MySQL backup, as it's a wastful thing to do in many cases.
If you choose this option, please show me the php script (hiding sensitive info), and I'll show you the better way.
By eliminating the middle-man (PHP), there will be less risk of failure, in future, too.
Here is my php file, that up until a couple of days ago had been working just fine:

<?php
$emailaddress = "warrenp@thegolfconn.com";
$host="mysql03.powweb.com"; // database host address
$dbuser="xxxxx"; // database user name
$dbpswd="xxxxx"; // database password
$mysqldb="xxxxx"; // name of database
$day = (date("d"));
$uname = get_current_user();
$filename = "/www/".substr($uname,0,1)."/$uname/backup$day.sql";
if ( file_exists($filename) ) unlink($filename);
system( "/usr/local/bin/mysqldump --user=$dbuser --password=$dbpswd --host=$host $mysqldb > $filename",$result);
$size = filesize($filename);
$runtime = (date(" F d h:ia"));
$message .= "The backup has been run.\n\n";
$message .= "The return code was: $result\n\n";
$message .= "Size of the backup: $size bytes\n\n";
$message .= "Server time of the backup: $runtime\n\n";
mail($emailaddress, "Backup Message" , $message, "From: Website <>");
?>

extras
10-6-05, 02:35 PM
Replace DBUSER, DBPASS, MYSQLDB with your own data, as usual.
If you have any special characters in the DBUSER, DBPASS, MYSQLDB, use single quotes around it.


28 3 * * * /usr/local/bin/mysqldump --user=DBUSER --password=DBPASS --host=mysql03.powweb.com MYSQLDB > backup`date "+\%d"`.sql 2>mysqldump.err



Note:

This one doesn't send e-mail.
If you want to get the confirmation e-mail (with file size, etc..), we have to add a littler more code.

EDIT:

I changed the code slightly because I forgot to add backslashe before %.
(In crontab, we need to escape % with a backslashe. Otherwise it acts like a newline.)

EDIT2:

If you want to have e-mail, following long long command will send a mail similar to the php code.

28 3 * * * DATE=`date "+\%d"`;/usr/local/bin/mysqldump --user=DBUSER --password=DBPASS --host=mysql03.powweb.com MYSQLDB > backup$DATE.sql 2>mysqldump.err;echo -e "To: warrenp@thegolfconn.com\nSubject: Backup Message\nFrom: Website\n\nThe backup has been run\nSize of the backup: `ls -l backup$DATE.sql`\nServer time of the backup: `date`\nError (if any): `cat mysqldump.err`" |/usr/sbin/sendmail -t

Tresclub
10-6-05, 04:28 PM
Just curious as to what may have happened to cause it to stop working. What changed?

Tresclub
10-6-05, 04:34 PM
Replace DBUSER, DBPASS, MYSQLDB with your own data, as usual.
If you have any special characters in the DBUSER, DBPASS, MYSQLDB, use single quotes around it.
OK, I'll give it a shot. Will be back tomorrow and let you know if I got the backup. Thanks!

ticoroman
10-6-05, 10:50 PM
This is the second time I see this error message mentioned to day.

Please submit a problem ticket to Support@powweb.com or thru OPS. You may also want to contact staff thru Chat to get this issue escalated.
I'm also seeing that error message. No crons are executed. I did already submit a support ticket (57.49 hours ago). The ticket has been escalated to the top and is currently reviewed by "ytjameslee". Hopefully it's fixed soon.

RTH10260
10-7-05, 05:12 AM
Possibly, it's caused by the setup of syslog server (which executes cronjobs).Hello extras, wasn't it announced recently that cronjobs now are running on the ftp server associated with the package ? Could it be that the ftp servers are not at the exact same config level as the syslog servers ?
_____________________________
add-on:
Since Oct4 cronjobs are now processed on the ftp server related to the package as was announced. There seems to be a problem that syslog servers continue to execute the same requests too. A problem ticket has been submitted.

extras
10-7-05, 09:08 AM
Well, maybe it's a ftp server.
I called syslog because 'hostname' says 'syslog01'.

Correction:

I checked the log, again, and indeed ftp0x.powweb.com is running it since Oct 3 about 9 PM.
Probably, I checked it too early, after the announcement.

Tresclub
10-7-05, 01:06 PM
Well, maybe it's a ftp server.
I called syslog because 'hostname' says 'syslog01'.
Correction:
I checked the log, again, and indeed ftp0x.powweb.com is running it since Oct 3 about 9 PM.
Probably, I checked it too early, after the announcement.
hmm, my last backup was at 03:38am on Oct 3rd.

extras
10-7-05, 01:11 PM
Did you check the log (backup/mysqldump.err)?
Check crontab with CronAid, as well.

Tresclub
10-7-05, 01:44 PM
OK, I'll give it a shot. Will be back tomorrow and let you know if I got the backup. Thanks!
OK, I got an email telling me that the backup was run, but I can't find the backup file. Any idea where it might be?
My previous backup file names were: backup01.sql, backup02.sql, backup03.sql, etc.

extras
10-7-05, 01:49 PM
Sorry, I thought it was /backup/ directory + 0x.sql, and placed unwantd slashe.
Please replace the code with new one found in the original post (I corrected them).

Tresclub
10-7-05, 02:34 PM
Sorry, I thought it was /backup/ directory + 0x.sql, and placed unwantd slashe.
Please replace the code with new one found in the original post (I corrected them).
OK, done. Be back maņana.

xXtreme
10-7-05, 02:57 PM
This is the second time I see this error message mentioned to day.

Please submit a problem ticket to Support@powweb.com or thru OPS. You may also want to contact staff thru Chat to get this issue escalated.

I posted the same error in another thread, opened a ticket with Powweb, even called .. still nothing from them :( Guess I can keep watching the thread ..

extras
10-7-05, 03:17 PM
I saw the thread.
http://forum.powweb.com/showthread.php?t=57291

But you didn't say much about the nature of script nor showed the crontab entry
and you didn't even replied to Richard.
Also, it wasn't exactly the same error (it could come from the same problem, though).

If you want more suggestions, please go back to the thread you started
and show more info, as well as the ticket number.

Tresclub
10-8-05, 12:52 PM
Sorry, I thought it was /backup/ directory + 0x.sql, and placed unwantd slashe. Please replace the code with new one found in the original post (I corrected them).
Ok. The backup file is there, but it is a zero. Got this email message:

"The backup has been run
Size of the backup: -rw-r--r-- 1 tgcbruce customer 0 Oct 8 03:28 backup08.sql
Server time of the backup: Sat Oct 8 03:28:00 PDT 2005
Error (if any): /usr/local/bin/mysqldump: Got error: 1045: Access denied for user 'DBUSER'@'10.0.97.18' (using password: YES) when trying to connect."

Probably because I forgot to edit the user name and password in your code with mine. Be back maņana.

Thanks for tyour help.

extras
10-8-05, 01:46 PM
Yup, you definitely need correct username and password.

Tresclub
10-9-05, 12:53 PM
OK, used correct user name and password, and got this error message:

/usr/local/bin/mysqldump: Got error: 1044: Access denied for user 'xxxx'@'%' to database 'MYSQLDB' when selecting the database

I substituted xxxx for my used name.

extras
10-9-05, 01:15 PM
You need to use your database name. I mean you need to replace MYSQLDB with your db name,
as it was in your old php script.

old php:
$host="mysql03.powweb.com"; // database host address
$dbuser="xxxxx"; // database user name
$dbpswd="xxxxx"; // database password
$mysqldb="xxxxx"; // name of database

Tresclub
10-10-05, 12:18 AM
You need to use your database name. I mean you need to replace MYSQLDB with your db name,
as it was in your old php script.

old php:
$host="mysql03.powweb.com"; // database host address
$dbuser="xxxxx"; // database user name
$dbpswd="xxxxx"; // database password
$mysqldb="xxxxx"; // name of database

OK, time for another try. I'll be back!

Tresclub
10-11-05, 03:26 AM
Looks like I got a good backup this morning. Thanks for all your help extras.

Tresclub
10-12-05, 12:29 PM
hmmm, very strange. I got a backup on Oct 10, it was twice as big in size as my previous backups.
Then, nothing since. No backups, no errors, no email notices.

Wonder what happened?

extras
10-12-05, 12:45 PM
Strange ...

If you didn't get e-mail and you don't see anything in /www/U/USER/etc/mysqldump.err,
then cronjob didn't run, most probably.

You may want to check it with CronAid, just in case, and then file a ticket if you see nothing wrong.
You can also perform the trouble shooting steps shown by the CronAid, or perform test run.
(To use the cron execution simulation feature, you need to edit the CronAid to set the variable to 1.)

As for the size, it should,'t change, scince it's the same command with same options.
You may want to check the DB with phpmyadmin or other tools to see if there were any major change.

Tresclub
10-12-05, 08:33 PM
Strange ...

If you didn't get e-mail and you don't see anything in /www/U/USER/etc/mysqldump.err,
then cronjob didn't run, most probably.

You may want to check it with CronAid, just in case, and then file a ticket if you see nothing wrong. You can also perform the trouble shooting steps shown by the CronAid, or perform test run. (To use the cron execution simulation feature, you need to edit the CronAid to set the variable to 1.)

As for the size, it should,'t change, scince it's the same command with same options.
You may want to check the DB with phpmyadmin or other tools to see if there were any major change.Where do I find this "CronAid"? File a ticket? Looked at all the files, and nothing seems to have changed.

Tresclub
10-12-05, 08:47 PM
Here is a screenshot of my server: Server Screenshot (http://www.thegolfconn.com/images/mysql01.jpg)

RTH10260
10-12-05, 11:11 PM
Where do I find this "CronAid"? Look in extras signature ...

Tresclub
10-13-05, 12:09 AM
aha, thanks RTH...

OK, I ran the cronaid.php program, but I don't see any errors indicated.

extras
10-13-05, 09:29 AM
Did it skip again?
Did you contact support (by ticket form in OPS, e-mail, chat, or phone)?
If so, post the ticket number. It may help a bit.

Tresclub
10-13-05, 07:12 PM
Did it skip again?
Did you contact support (by ticket form in OPS, e-mail, chat, or phone)?
If so, post the ticket number. It may help a bit.Yes, it skipped again.
Here is the ticket number: 407239510002b882.
I posted it on 10-6, but have only received emails saying they will look into it.

Tresclub
10-15-05, 03:03 PM
Still no solution from Powweb Tech Support.

extras
10-15-05, 10:04 PM
If you edit crontab file, it may have an effect of reloading (I'm not sure, though).
You can add another new line at the end, for example.
But you really need to keep waiting for the support if that doesn't work.

Tresclub
10-16-05, 12:54 PM
Got this email this morning"

The backup has been run
Size of the backup: -rw-r--r-- 1 tgcbruce customer 28260333 Oct 16 03:28 backup16.sql
Server time of the backup: Sun Oct 16 03:28:10 PDT 2005
Error (if any):

Have no idea why, as I hadn't done anything. The file size is again 27, 597kb, whereas my old backups were only 10,974kb.

extras
10-16-05, 01:49 PM
Your database doesn't grow?

If you upload/move to a directory I can access and PM me the link, I'll take a look, later.

Tresclub
10-17-05, 01:23 AM
Your database doesn't grow?
If you upload/move to a directory I can access and PM me the link, I'll take a look, later.The first file is the 10kb file from the original crontab code. The second file is the 27kb file from your crontab code.

extras
10-17-05, 10:43 AM
They are not taken from the sme DB.
Did you upgrad yourBBS?

And they are on different server and curiously dumped by different version of mysqldump.

diff output

< -- MySQL dump 10.2
---
> -- MySQL dump 10.9
3c3
< -- Host: mysql03.powweb.com Database: gol********
---
> -- Host: mysql10.powweb.com Database: vbg********


They are 10Mbyte and 27Mbyte ...... not kilo byte.

Tresclub
10-18-05, 01:15 AM
They are not taken from the sme DB.
Did you upgrad yourBBS?

And they are on different server and curiously dumped by different version of mysqldump.

diff output

< -- MySQL dump 10.2
---
> -- MySQL dump 10.9
3c3
< -- Host: mysql03.powweb.com Database: gol********
---
> -- Host: mysql10.powweb.com Database: vbg********


They are 10Mbyte and 27Mbyte ...... not kilo byte.
Then why does the file size say: 10,975KB and 27,598KB?

I don't understand what is going on here. The 10,975 b/u is for my baseball league webboard which is quite a bit smaller than my golf webboard.
mysql03 is the server for my golfsite webboard.
[B]mysql10 is an old server for my online computer baseball league webboard, which has been on mysql08 for some time.
The crontab file is for mysql03. I have no idea how/why I would get a backup for mysql10 server.
The last two backups I have received (on the 16th and 17th) have both been for my sql03 (golfsite webboard) server, so it appears to be working now like it should be. Apparently, and here again I have no idea how/why, those first smaller backups were obviously for my baseball league webboard.

extras
10-18-05, 10:38 AM
Then why does the file size say: 10,975KB and 27,598KB?
Where did you get those numbers?
Maybe you found a bug of a scrip/program. ;)


I don't understand what is going on here. The 10,975 b/u is for my baseball league webboard which is quite a bit smaller than my golf webboard.
mysql03 is the server for my golfsite webboard.
[B]mysql10 is an old server for my online computer baseball league webboard, which has been on mysql08 for some time.
The crontab file is for mysql03. I have no idea how/why I would get a backup for mysql10 server.
The last two backups I have received (on the 16th and 17th) have both been for my sql03 (golfsite webboard) server, so it appears to be working now like it should be. Apparently, and here again I have no idea how/why, those first smaller backups were obviously for my baseball league webboard.

It must be you who put the DB name and MySQL server name in the script and/or crontab.
These command/script can't change the configuration by themselves. :)

If you want to change, just edit and set it up correctly.

And don't forget to remove the backup files you placed for me.

Tresclub
10-18-05, 05:57 PM
Will do, and thanks a lot "extras' for all your help with this.