Anacrusis Posted October 10, 2003 Posted October 10, 2003 Hi all, I'm new around here and am very excited about being a part of the family. I've run into my first problem, I'm trying to setup the scipt that I found here: http://www.phpfreaks.com/script/view/11.php I've set it up in cron to ftp the database backup to me. When the job runs, I get emailed with this error message: tar: acgearc_db1-101003-1031am.sql: Cannot stat: No such file or directorytar: Error exit delayed from previous errors sh: line 1: ncftpput: command not found Anybody know how I can get this to work? Thanks in Advance. -- Adam Quote
surefire Posted October 10, 2003 Posted October 10, 2003 http://www.totalchoicehosting.com/forums/i...?showtopic=2591 It does take some experimenting before you get it right. I gotta run but will try to be more detailed if the above thread doesn't help you enough. Quote
Anacrusis Posted October 10, 2003 Author Posted October 10, 2003 Ok, I've got it to create a backup of the database but in the sql in generates, all the comments are using ---- instead of ## . This is causing problems when I try to import the script. I'm also still getting "ncftpput: command not found" Do I need to change that to use a different FTP package? Quote
Anacrusis Posted October 13, 2003 Author Posted October 13, 2003 Can anybody help me with the above error? Quote
borfast Posted October 13, 2003 Posted October 13, 2003 (edited) Hi Anacrusis. Yes, that error message means you'll have to use another ftp program, since ncftpput is not available. What do you want that cron job to do? Save the file into your account space? Perhaps you can just write it to a directory instead of uploading it... If that suits you, I can give you a hand at setting it up. Edited November 25, 2003 by TCH-Raul Quote
Anacrusis Posted October 13, 2003 Author Posted October 13, 2003 I want the cron job to create the database backup, then upload it to my server that I'm running in-house. Do you know why the comments are coming out wrong? Quote
surefire Posted October 13, 2003 Posted October 13, 2003 I've successfully used this script as-is after minor modifications. I have been ftp-ing the database backup to my site every day for many months. The script does work... I'm not sure what problems you're running into. I've read your posts and the only thing I could recommend is reinstalling the script and taking great care when you edit. Sorry I don't have a more specific answer. Quote
Anacrusis Posted October 13, 2003 Author Posted October 13, 2003 How can I overcome the "ncftpput: command not found" error? It seems to me that ncftpput is not on the server. I didn't change anything relating to FTP in the script other then my server address and user/pass. As for the comments, It's probably one of the paramaters I'm using for the mysql dump command. I'll look into that. Quote
shakes Posted October 13, 2003 Posted October 13, 2003 if it helps any i just shelled into my acct and wasn't able to execute ncftpput ... I've never used that util so I'm taking your word for it that that's what it's called. I also did a whereis ncftpput and came up with nothing ... is it a possibility that this util is on some servers but not others? I'm on server 40 and I don't know about the comments thing ... sorry ... I would like to know the answer to that tho because I have the same problems trying to restore DBs with --- as comment identifiers Quote
Anacrusis Posted October 13, 2003 Author Posted October 13, 2003 Yea, I'm also on server 40. Maybe it's just not installed on our server Quote
borfast Posted October 14, 2003 Posted October 14, 2003 (edited) Well, I just tried it on my personal account and it worked, so could one of you guys submit a help desk ticket so one of the admins can take a look at it? Thanks As for the '----' comments, unfortunately that's just the way the mysqldump tool works Perhaps you want to add this snippet to your backup script, right after the passthru("mysqldump......."); line: >//************************ // Replace the '---' comments from the beginning of each line with the phpMyAdmin-compatible '###' $lines = file($savepath/$dbname.sql); $newlines = preg_replace("#^-+(.+?)#", "## \\1", $lines); $count = count($lines); $fd = fopen($savepath/#dbname.sql, "w"); for($i = 0; $i < $count; $i++) { fwrite($fd, $newlines[$i]); } fclose($fd); //************************ This will open the newly created .sql file and replace every line starting with one or more '-', with the same line but starting only with '##'. I tried it with a simple file here on my computer and it worked. Hope this helps Edited October 15, 2003 by borfast Quote
Anacrusis Posted October 14, 2003 Author Posted October 14, 2003 Thanks, I'll give that a try as soon as I get a chance and let you know how it works. I'll also submit a help desk ticket now. Quote
borfast Posted October 14, 2003 Posted October 14, 2003 The server I tried this on was server 6. Quote
Anacrusis Posted October 14, 2003 Author Posted October 14, 2003 Thanks for the code borfast, it's works beutifully! This works on server 40 now, ncftp was installed today, it wasn't previously and that's what was causing problems. Thanks TCH team for such a quick response and resolution to my support ticket. Rock Sign Thumbs Up Quote
DoubleM Posted November 25, 2003 Posted November 25, 2003 Thank you Bill for helping me with this. Rock Sign Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.