Jump to content

Recommended Posts

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 directory

tar: 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

Link to post
Share on other sites

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?

Link to post
Share on other sites

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 by TCH-Raul
Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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

Link to post
Share on other sites

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 :dance:


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]);

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 by borfast
Link to post
Share on other sites

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

Link to post
Share on other sites
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...