Web Hosting Forum | Lunarpages
News: October 6, 2008 - Submit Your Site for the October 2008 Site of the Month!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 11, 2008, 02:15:55 AM


Login with username, password and session length


Pages: 1 ... 5 6 [7]   Go Down
  Print  
Author Topic: Site and MySQL backups via cron  (Read 32223 times)
Chelle
Intergalactic Superstar
*****
Offline Offline

Posts: 170



WWW
« Reply #90 on: November 29, 2007, 08:47:53 AM »

Been using the Backup and send via email for a while.  Suddenly for one of my domains, I'm not getting the email anymore, not since the 21st.  Checked into a few things and if I delete the last line where it deletes the file from the server, that works fine, my backup is in the folder where I designate it. 

Any ideas on what would cause the email to not send so I know where to look and trace the issue?
Logged

"The axe forgets.  The tree remembers" -African Proverb

"My eccentricity has nothing to do with my stablization" -Chelle
capslock
Newbie
*
Offline Offline

Posts: 2


« Reply #91 on: December 07, 2007, 12:09:53 AM »

usefull,3ks
Logged
jlehmer
Newbie
*
Offline Offline

Posts: 1


« Reply #92 on: December 26, 2007, 08:31:06 AM »

I'm trying to use the db backup script that emails the zip file.  Everything is working fine except when I receive the email the file that is attached is empty, 0K.  I can see on the file system the file has been created and has a size of 136K, so I wouldn't expect the file size to hitting an attachment limit.

I show in one of the reply posts to change the content type value to "application/x-gzip" that didn't seem to make a difference.  Could there be something wrong with this command:

$data = chunk_split(base64_encode(implode("", file($filename))));

Any help you can provide is appreciated.
Logged
chunkyq
Newbie
*
Offline Offline

Posts: 1


« Reply #93 on: February 06, 2008, 12:29:23 AM »

Is there a simple tweak for one of scanman's scripts that will allow me to zip just one subdirectory in my public_html directory and have it emailed to me?

I'm not talking about database backups ... have that working already courtesy of scanman.  Smiling

Most of my site is static so I don't need to / want to back all of it up repeatedly via ftp over my slow connection ... i just want to send copies of the folders with changing information to my email.

I know this is similar to the post from mefromla but i didn't see a reply and i'm also curious about the emailing part.

many thanks!
Logged
Jason2
Intergalactic Superstar
*****
Offline Offline

Posts: 199


WWW
« Reply #94 on: February 10, 2008, 12:37:10 PM »

I'm not receiving the backups for some reason, here's what I have set up. I have  chosen the script 'Have it FTPed to you' .... made a 'backup.php' file, copied the script in there, uploaded it too, /public_html/backup.php

Then here's the cron job I have set-up:

/home/theco55/public_html/backup.php  ............. I have it set at 4=4am ... every two days ... but it's been a few days, and I haven't received it yet. Anyone got any ideas why?

Regards Jason
Logged

"Anyone who has never made a mistake has never tried anything new." -- Albert Einstein
scanman20
Master Jedi
*****
Offline Offline

Posts: 1251



WWW
« Reply #95 on: February 15, 2008, 04:34:46 PM »

If your cron job is truly /home/theco55/public_html/backup.php then you're missing the php command in front of it.
Logged

Even a broken clock is right twice a day.
NotOneBit.com
MCSE - MCSA - MCP
gta
Newbie
*
Offline Offline

Posts: 1


« Reply #96 on: April 24, 2008, 03:35:10 PM »

so does anyone have the proper one that works and can post for free here please with instuctions and codes
Logged
scanman20
Master Jedi
*****
Offline Offline

Posts: 1251



WWW
« Reply #97 on: April 25, 2008, 06:17:20 AM »

Proper one? That works? For free? Instructions and codes?

Did you even read this thread? Start at the beginning. The code is free, works, and is spelled out for you.
Logged

Even a broken clock is right twice a day.
NotOneBit.com
MCSE - MCSA - MCP
officexpboy
Intergalactic Cowboy
*****
Offline Offline

Posts: 63


To succeed in your mission, you must have single-minded devotion to your goal


« Reply #98 on: May 06, 2008, 10:14:28 PM »

How to do remote connection to MySQL from client??

For example i've application where have database at local/client side where i am saving my data.
And then i've to upload all this data on server Mysql (lunar pages) where i will use it on my web application.


I m trying like -

1. mysqldump of local database
2. upload it to server using FTP
3. restore it on server mysql database using mysql comand.


Please guide me.


Thanks ,
Logged

To succeed in your mission, you must have single-minded devotion to your goal
chrisedwards2004
Newbie
*
Offline Offline

Posts: 3


« Reply #99 on: May 20, 2008, 06:28:12 AM »

Thanks for the scripts Scanman. I think it would be more secure to put the backup.php script file in a directory other than public_html. I came across another script which stated: "For security’s sake, it is very important that you make sure this file is located outside your document root (public_html) with permissions of 600." See:

http://www.v-nessa.net/2007/01/03/cpanel-automated-backup-script
Logged
jimlongo
Spacescooter Operator
*****
Offline Offline

Posts: 47



WWW
« Reply #100 on: May 21, 2008, 02:54:22 PM »

Very strange, I had this (just backing up and gzipping the file and leave it on the server) working and just today checked  one of my backup files and when I expanded the gzipped file the filesize became 0 bytes.
But what appears to be the gzip file is actually the sql file unzipped!? Confused

Here's the relevant lines of the script I run
Code:
$filename= "../_BACKUP/SQLBU_prstoronto-$datestamp.sql.gz"; 
$command = "mysqldump -u $dbuser --password=$dbpwd $dbname | gzip > $filename";
$result = passthru($command);

So I just removed the .gz from the $filename and all seems to be well. 

I've tried various configurations of removing the gzip from the $command line but it doesn't run properly.  In that case it leaves an .sql file 0 bytes in size.

This is on the server "ogma".






Logged
chrisedwards2004
Newbie
*
Offline Offline

Posts: 3


« Reply #101 on: June 05, 2008, 05:37:01 AM »

I am trying to get the Scanman site FTP script to generate a full site backup in my home/username director--so far with no luck (the db email script works fine).

I use the following cronjob: php -q /home/username/site_backup.php.

Can anyone see anything obviously wrong in the following configuration of the script which is saved in a file named site_backup.php and placed in my home/username directory? It has the CHMOD: 600--this works for the database email script which is in the same directory.

/* CONFIGURE THE FOLLOWING VARIABLES TO MATCH YOUR SETUP */
$filename= "home/username/Full_Account_Backup-$datestamp.tar";   // The name (and optionally path) of the dump file
$ftp_server = "mydomain.org";      // Name or IP. Shouldn't have any trailing slashes and shouldn't be prefixed with ftp://
$ftp_port = "21";   // FTP port - blank defaults to port 21
$ftp_username = "ftp username";      // FTP account username
$ftp_password = "ftp password";      // FTP account password - blank for anonymous
$filename = "home/ftp username/" . $filename . ".gz";

$command = "tar cvf ~/$filename ~/*";
$result = exec($command);

$command = "gzip -9 -S .gz ~/$filename";
$result = exec($command);

// set up basic connection
$ftp_conn = ftp_connect($ftp_server);

// Turn PASV mode on or off

ftp_pasv($ftp_conn, false);

// login with username and password
$login_result = ftp_login($ftp_conn, $ftp_username, $ftp_password);

// check connection
if ((!$ftp_conn) || (!$login_result))
{
   echo "FTP connection has failed.";
   echo "Attempted to connect to $ftp_server for user $ftp_username";
   exit;
}
else
{
   echo "Connected to $ftp_server, for user $ftp_username";
}

// upload the file
$upload = ftp_put($ftp_conn, "foo.tar.gz", $filename, FTP_BINARY);

// check upload status
if (!$upload)
{
   echo "FTP upload has failed.";
}
else
{
   echo "Uploaded $filename to $ftp_server.";
}

// close the FTP stream
ftp_close($ftp_conn);

unlink($filename);   //delete the backup file from the server
?>


This is the error e-mail message I get:

tar: /home/ftp username/home/ftp username/home/ftp username/Full_Account_Backup-2008-06-09_03-00-03.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
gzip: /home//home/ftp username/home/ftp username/Full_Account_Backup-2008-06-09_03-00-03.tar.gz: No such file or directory
<br />
<b>Warning</b>:  ftp_login() [<a href='function.ftp-login'>function.ftp-login</a>]: Login authentication failed in <b>/home/ftp username/site_backup.php</b> on line <b>26</b><br />
FTP connection has failed.Attempted to connect to mydomain.org for user ftp username
« Last Edit: June 09, 2008, 05:45:47 AM by chrisedwards2004 » Logged
chrisedwards2004
Newbie
*
Offline Offline

Posts: 3


« Reply #102 on: June 10, 2008, 05:47:06 AM »

I finally got a result of sorts from the site FTP backup script. A backup file appeared in the home/username directory, but when I opened up the archive, it was an incomplete backup. I compared it with a manually generated full backup archive and it contained only a few of the directories.


This is the configuration of Scanman's script that worked:


<?
$datestamp = date("Y-m-d_H-i-s");      // Current date to append to filename of backup file in format of YYYY-MM-DD

/* CONFIGURE THE FOLLOWING VARIABLES TO MATCH YOUR SETUP */
$filename= "backup-$datestamp.tar";   // The name (and optionally path) of the dump file
$ftp_server = "mydomain.org";      // Name or IP. Shouldn't have any trailing slashes and shouldn't be prefixed with ftp://
$ftp_port = "21";   // FTP port - blank defaults to port 21
$ftp_username = "username";      // FTP account username
$ftp_password = "password";      // FTP account password - blank for anonymous
$filename = "username" . $filename . ".gz";

$command = "tar cvf ~/$filename ~/*";
$result = exec($command);

$command = "gzip -9 -S .gz ~/$filename";
$result = exec($command);

// set up basic connection
$ftp_conn = ftp_connect($ftp_server);

// Turn PASV mode on or off

ftp_pasv($ftp_conn, false);

// login with username and password
$login_result = ftp_login($ftp_conn, $ftp_username, $ftp_password);

// check connection
if ((!$ftp_conn) || (!$login_result))
{
   echo "FTP connection has failed.";
   echo "Attempted to connect to $ftp_server for user $ftp_username";
   exit;
}
else
{
   echo "Connected to $ftp_server, for user $ftp_username";
}

// upload the file
$upload = ftp_put($ftp_conn, "foo.tar.gz", $filename, FTP_BINARY);

// check upload status
if (!$upload)
{
   echo "FTP upload has failed.";
}
else
{
   echo "Uploaded $filename to $ftp_server.";
}

// close the FTP stream
ftp_close($ftp_conn);

unlink($filename);   //delete the backup file from the server
?>


This is the email message I received--any comments on the significance of its contents would be appreciated:

tar: Removing leading `/' from member names
tar: /home/username/public_ftp/.ftpquota: Cannot open: Permission denied
tar: Error exit delayed from previous errors
gzip: /home/username/usernamebackup-2008-06-10_02-00-03.tar.gz already has .gz suffix -- unchanged
<br />
<b>Warning</b>:  ftp_login() [<a href='function.ftp-login'>function.ftp-login</a>]: Login authentication failed in <b>/home/manch8/site_backup.php</b> on line <b>26</b><br />
FTP connection has failed.Attempted to connect to mydomain.org for user manch8
« Last Edit: June 10, 2008, 08:06:06 AM by chrisedwards2004 » Logged
Pages: 1 ... 5 6 [7]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.6 | SMF © 2006-2008, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM