Jump to content

brockhosting

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by brockhosting

  1. This is fast and easy. I'll post it even though i'm not a TCH client any more because this thread got me to write this script. Should work great for server to server backups because its FTP. This can be set up as a one touch backup system or threw a cron job. ><? // A script produced by BrockHosting.com // For more help visit http://www.brockhosting.com/bb/viewtopic.php?p=13 $user_name = "not_root"; // YOUR cpanel user name $user_pass = "password_here"; // YOUR cpanel password $user_website = "www.brockhosting.com"; // YOUR website do NOT include http:// $ftp_server_ip = "1.2.3.4"; // Server IP here $ftp_server_user = $user_name."_ftp"; // FTP login name here $ftp_server_pass = "Hd3Z6wpf"; // FTP password here $db_list = array("phpbb1","ptp","rcash"); // List of your databases // Must be "database1","Database2" // DO NOT ENTER "username_database1", "username_database2" // Do not edit below this line $dc = time(); $looper = 0; while($db_list[$looper] != null) { $db_name = $db_list[$looper]; $get_this = "http://".$user_name.":".$user_pass."@".$user_website.":2082/getsqlbackup/".$db_name.".gz"; echo "\n<br><br>\nAtempting to downlaod $db_name"; $handle = fopen($get_this, "r"); $save_as = "backup_".$db_name."_".$dc."_.gz"; if ($handle != null) { $local_handle = fopen($save_as,"x"); echo "\n<br>Saveing \"$db_name\" as \"$save_as\" "; while(!feof($handle)){ fwrite($local_handle,fgets($handle)); } } fclose($handle); fclose($local_handle); // Got file need ftp home $ftp_conn_id = ftp_connect($ftp_server_ip) or die("Couldn't connect to $ftp_server_ip"); ftp_login($ftp_conn_id,$ftp_server_user,$ftp_server_pass); $upload = ftp_put($ftp_conn_id, $save_as, $save_as, FTP_BINARY); if ($upload != null) { echo "\n<br>File Sent!\n"; unlink($save_as); } else { echo "\n<br>File NOT SENT!\n"; } $looper++; } ?>
  2. Yeah I got that part I just cant seem to get it to mail me the .gz file.
  3. php /home/brockho/auto_backup/my_backup_system.php Thats what I have now and it works. Now to try to get it to mail it to me every night. This fourm took a long time to read but it helped a LOT thanks.
  4. I got this to work from one server to another. So it should be fine for off site backups. Now could some one tell me how I can get this script to "go off" every 6 hours with the cron system? I keep getting a 404 error. ><? $user_name = "you_user_name_here"; $user_pass = "your_pass_word_here"; $user_website = "www.your_full_domain_name_here.com"; $db_list = array("phpbb1","rface"); // "Backthisup", "backthisup2" $looper = 0; // Do not edit below this line $dc = time(); while($db_list[$looper] != null) { $db_name = $db_list[$looper]; $get_this = "http://".$user_name.":".$user_pass."@".$user_website.":2082/getsqlbackup/".$db_name.".gz"; echo "<br>Atempting to downlaod $db_name"; $handle = fopen($get_this, "r"); $save_as = "backup_".$db_name."_".$dc."_.gz"; if ($handle != null) { $local_handle = fopen($save_as,"x"); echo "<br>Saveing $db_name as $save_as <br>"; while(!feof($handle)) { fwrite($local_handle,fgets($handle)); } } fclose($handle); fclose($local_handle); $looper++; } ?>
  5. I get this error when I look at the dbsender.php script "Warning: filetype(): open_basedir restriction in effect" This is getting very complacated. I did the chmod and still get the same error. Cron job wont allways send e-mails but i dont get the fiel via e-mail eather. Very lost here.
×
×
  • Create New...