NYCPHP Meetup

NYPHP.org

[nycphp-talk] Backup

Donald Organ donald at saturn5net.com
Fri Jul 30 12:21:25 EDT 2004


will script execution time affect these if it hase to download 500+ MB


----- Original Message ----- 
From: "Eddie Haber" <php at haberco.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Friday, July 30, 2004 12:13 PM
Subject: Re: [nycphp-talk] Backup


> I did this same thing recently for a project. Divide the tasks into two
> scripts so you don't have to worry about network latencies.
>
> DB_backup.php
> DB_ftp.php
>
>
> In DB_backup.php you just need to execute this command:
>
> <?
> exec("mysqldump --opt -u $USER --password=\"$PASSWORD\"  $DATABASE |
gzip -c
> > $LOCAL_FILENAME");
> ?>
>
> (and manage some error trapping and logging if you want).
> IN DB_ftp.php use the ftp functions:
>
> <?
>
> $conn_id = ftp_connect($HOST);
> $login_result = ftp_login($conn_id, $HOST_UNAME, $HOST_PWORD);
> if ((!$conn_id) || (!$login_result)) {
>     // print or log the next line
>     print "FTP connection has failed. Could not connect to host: $HOST.";
>     exit;
> }
>
> // put file
> if ( ! ftp_put($conn_id, $REMOTE_FILENAME, $LOCAL_FILENAME, FTP_ASCII) )
> {
>     // print or log the next line
>     print "Error copying file. Could not copy file to server.";
>     exit;
> }
> else
> {
>     // print or log the next line
>     print "Copy successful .";
> }
>
> // close connection
> ftp_close($conn_id);
>
> ?>
>
> The crontab -e and set something like:
>
> 5 0 * * *   php /path/to/script/DB_backup.php
> 10 0 * * *  php /path/to/script/DB_ftp.php
>
>
> Hope this helps.
> Eddie
>
>
>
>
> On 7/30/04 11:22 AM, "Donald Organ" <donald at saturn5net.com> wrote:
>
> > basically what i was planning on doing was writing a PHP script that i
could
> > cron to pull the info from a DB on all the Hosts and shares that have to
be
> > backed up and then just copy all of it down to the linux server.
> >
> >
> > ----- Original Message -----
> > From: "mike hjorleifsson" <mikeh at dtev.com>
> > To: "NYPHP Talk" <talk at lists.nyphp.org>
> > Sent: Friday, July 30, 2004 11:22 AM
> > Subject: Re: [nycphp-talk] Backup
> >
> >
> >> rsync is fast, and you can tunnell securely with ssh
> >>
> >> Donald Organ wrote:
> >>
> >>> Does anyone know of good software that I can implement on my network,
> > what i
> >>> am looking to do is backup web and sql directorys on a windows box to
a
> >>> linux box via samba, if any on has any experience in this please email
me
> >>> off the list.
> >>>
> >>> _______________________________________________
> >>> New York PHP Talk
> >>> Supporting AMP Technology (Apache/MySQL/PHP)
> >>> http://lists.nyphp.org/mailman/listinfo/talk
> >>> http://www.newyorkphp.org
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >> -- 
> >> =======================
> >> Mike Hjorleifsson
> >> 1110 South Ave
> >> Staten Island, NY 10314
> >> Direct Ph: 718-247-4263
> >> Fx: 718-247-1673
> >> Online Store: http://www.elementcomputer.com
> >>
> >> PLEASE NOTE:  This e-mail message may contain confidential and
privileged
> > material for the sole use of the intended recipient(s). If you are not
the
> > intended recipient you are hereby notified that you have received this
> > document in error and that any review, dissemination, distribution, or
> > copying of this message is strictly prohibited. If you have received
this
> > communication in error,please contact me immediately by e-mail or by
> > telephone at (888) 858-4ION and delete the original message and any
copies.
> > Thank you.
> >>
> >> _______________________________________________
> >> New York PHP Talk
> >> Supporting AMP Technology (Apache/MySQL/PHP)
> >> http://lists.nyphp.org/mailman/listinfo/talk
> >> http://www.newyorkphp.org
> >
> > _______________________________________________
> > New York PHP Talk
> > Supporting AMP Technology (Apache/MySQL/PHP)
> > http://lists.nyphp.org/mailman/listinfo/talk
> > http://www.newyorkphp.org
>
>
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org




More information about the talk mailing list