I have a server in my room with a duo-core processor and basic internet (nothing fancy)
I’m running ubuntu 11.04 and I’m running a php script from the crontab.
0 3 * * * php back_up_to_s3.php
This script takes about 20-30 minutes to run. It works fine when run from the crontab, however if I run it at the same time as other scripts that take about 5-10 minutes to run.
0 3 * * * php back_up_to_s3.php
0 3 * * * php do_this.php
0 3 * * * php do_that.php
It doesn’t finish. My guess is that it’s timing out. Here is the source of back_up_to_s3.php
include('Zend/Service/Amazon/S3.php');
include("connect_to_database.php");
$my_aws_key = '******';
$my_aws_secret_key = '******';
Zend_Service_Amazon_S3::setKeys($my_aws_key, $my_aws_secret_key);
$s3 = new Zend_Service_Amazon_S3();
$fileName = exec("date +'%m_%d_%y'") . '.tar';
$filePath ="/home/me/temp_db_backups/$fileName";
exec("mysqldump -h localhost -u root -ppassword DATABASE_NAME > $filePath");
$s3->putObject('myBucket/' . $fileName, file_get_contents($filePath),
array(Zend_Service_Amazon_S3::S3_ACL_HEADER =>
Zend_Service_Amazon_S3::S3_ACL_PRIVATE,
Zend_Service_Amazon_S3::S3_CONTENT_TYPE_HEADER =>
'audio/mpeg'
));
unlink($filePath);
I know the script doesn’t finish because the tarred backup does not appear in my s3 bucket. However the tar file gets created and is still in my /home/me/temp_db_backups so I know the script terminates while $s3-putObject executes.
Hello LedZeppelin (doubt if I will every get to say that 🙂
Instead of guessing what could be happening, redirect the output to a log file and you will know for sure