|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I have a conundrum best explained by the following items:
Cut from "man ncftpget": DIAGNOSTICS ncftpget returns the following exit values: 0 Success. -------------------------------=<(*)>=-------------------------------- Snippet from "bak_website" script: echo "bak_website: Now archiving http://mywebsite.com" ncftpget -RV -u user -p passwd ftp://mywebsite.com . # move and list the archived files val=$? if [ $val -eq 0 ]; then mvarc # moves files from dir n to dir n+1 else echo "bak_website failed" fi -------------------------------=<(*)>=-------------------------------- Message 44: From droid@opus.ynet Mon Nov 12 04:17:56 2007 X-Original-To: droid Delivered-To: droid@opus.ynet From: droid@opus.ynet To: droid@opus.ynet Subject: Cron <droid@opus> /usr/local/bin/bak_website X-Cron-Env: <SHELL=/bin/sh> X-Cron-Env: <HOME=/droid> X-Cron-Env: <PATH=/usr/bin:/bin> X-Cron-Env: <LOGNAME=droid> X-Cron-Env: <USER=droid> Date: Mon, 12 Nov 2007 04:00:02 -0500 (EST) bak_website: Now archiving http://mywebsite.com ncftpget: server said: File successfully transferred bak_website failed -------------------------------=<(*)>=-------------------------------- On inspection I find the file was successfully transferred but mvarc never executes. Shouldn't the message from the remote server set a return code of zero? How can I capture ncftpget's return code? droid -- Whom computers would destroy, they must first drive mad. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On 2007-11-12, Jim Showalter <jshowalter@gmail.com> wrote:
> I have a conundrum best explained by the following items: > > Cut from "man ncftpget": > > DIAGNOSTICS > ncftpget returns the following exit values: > > 0 Success. > > -------------------------------=<(*)>=-------------------------------- > > Snippet from "bak_website" script: > > echo "bak_website: Now archiving http://mywebsite.com" > ncftpget -RV -u user -p passwd ftp://mywebsite.com . > > # move and list the archived files > val=$? > if [ $val -eq 0 ]; then > mvarc > # moves files from dir n to dir n+1 > else > echo "bak_website failed" > fi > > -------------------------------=<(*)>=-------------------------------- > > Message 44: > From droid@opus.ynet Mon Nov 12 04:17:56 2007 > X-Original-To: droid > Delivered-To: droid@opus.ynet > From: droid@opus.ynet > To: droid@opus.ynet > Subject: Cron <droid@opus> /usr/local/bin/bak_website > X-Cron-Env: <SHELL=/bin/sh> > X-Cron-Env: <HOME=/droid> > X-Cron-Env: <PATH=/usr/bin:/bin> > X-Cron-Env: <LOGNAME=droid> > X-Cron-Env: <USER=droid> > Date: Mon, 12 Nov 2007 04:00:02 -0500 (EST) > > bak_website: Now archiving http://mywebsite.com > ncftpget: server said: File successfully transferred > bak_website failed > > -------------------------------=<(*)>=-------------------------------- > > On inspection I find the file was successfully transferred but mvarc > never executes. Shouldn't the message from the remote server set a > return code of zero? How can I capture ncftpget's return code? > val=$? echo "return code=$val" You might try adding the -d option to ncftpget. It could be that one or more files were transferred successfully but some were not, or the ftp server is not a Unix server. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Nov 12, 9:12 am, Bill Marcum <marcumb...@bellsouth.net> wrote:
> > val=$? > echo "return code=$val" > > You might try adding the -d option to ncftpget. It could be that one or > more files were transferred successfully but some were not, or the ftp > server is not a Unix server. Good idea, Bill. I will try that tonight and post findings here. There must be some problem files causing an error return, because the server is Unix. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
> On Nov 12, 9:12 am, Bill Marcum <marcumb...@bellsouth.net> wrote:
> > > > > val=$? > > echo "return code=$val" > > > You might try adding the -d option to ncftpget. It could be that one or > > more files were transferred successfully but some were not, or the ftp > > server is not a Unix server. Good suggestions, Bill. I added "echo "return code=$val"" and used "- d ncftpget.log". The server is Linux, so that is not the problem. The latest cron message has: bak_website: Now archiving http://mywebsite.com ncftpget: server said: File successfully transferred return code=3 bak_website failed The ncftpget.log file is 805954 bytes - ncftpget does a lot of business! But grepping it for "error", "fail" and "warn" returns nothing. Could return code 3 be set by the server message, "File successfully transferred" instead of by ncftpget? |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On 2007-11-13, droid <jshowalter@gmail.com> wrote:
>> On Nov 12, 9:12 am, Bill Marcum <marcumb...@bellsouth.net> wrote: >> >> >> >> > val=$? >> > echo "return code=$val" >> >> > You might try adding the -d option to ncftpget. It could be that one or >> > more files were transferred successfully but some were not, or the ftp >> > server is not a Unix server. > > Good suggestions, Bill. I added "echo "return code=$val"" and used "- > d ncftpget.log". The server is Linux, so that is not the problem. > The latest cron message has: > > bak_website: Now archiving http://mywebsite.com > ncftpget: server said: File successfully transferred > return code=3 > bak_website failed > > The ncftpget.log file is 805954 bytes - ncftpget does a lot of > business! But grepping it for "error", "fail" and "warn" returns > nothing. > Could you post a sample of that file, maybe the first or last 20 lines? > Could return code 3 be set by the server message, "File successfully > transferred" instead of by ncftpget? > That should not happen. Maybe you could try changing http:// to ftp://. Have you tried getting files manually one at a time to see if you get an error? Or you might try a loop like this: until ncftpget -R http://mywebsite.com; do sleep 60; done By default, ncftpget should try to resume a failed transfer, but this might be a waste of time if the transfer failed for reasons other than a broken connection (e.g. permission problems, i/o errors or disk full). |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On Nov 13, 3:02 pm, Bill Marcum <marcumb...@bellsouth.net> wrote:::
> > Could you post a sample of that file, maybe the first or last 20 > lines? Output of "tail -n 20 ncftpget.log" Cmd: MDTM stats/index.html 213: 20071112130935 Cmd: PASV 227: Entering Passive Mode (208,109,181,123,187,244) Cmd: RETR stats/index.html 150: Accepted data connection 226: File successfully transferred 0.000 seconds (measured here), 15.92 Mbytes per second Cmd: MDTM stats/navfile.html 213: 20071112130935 Cmd: PASV 227: Entering Passive Mode (208,109,181,123,250,77) Cmd: RETR stats/navfile.html 150: Accepted data connection 4.1 kbytes to download 226: File successfully transferred 0.000 seconds (measured here), 118.22 Mbytes per second Cmd: QUIT 221: Goodbye. You uploaded 0 and downloaded 18481 kbytes. Logout. > > > Could return code 3 be set by the server message, "File successfully > > transferred" instead of by ncftpget? > > That should not happen. Maybe you could try changing http:// to ftp://. The ncftpget command line does access "ftp://mywebsite.com" (see my first post). The "http://" thing is just the echo line. > > Have you tried getting files manually one at a time to see if you get an error? I've used get from plain ftp and also mirrored the entire site using wget. Or did you mean: use ncftpget to get files one-at-a-time? > > Or you might try a loop like this: until ncftpget -Rhttp://mywebsite.com;do sleep 60; done > > By default, ncftpget should try to resume a failed transfer, but this > might be a waste of time if the transfer failed for reasons other than > a broken connection (e.g. permission problems, i/o errors or disk full). You really think it's an error then? I'm not sure. I get consistent results every run, the total bytes downloaded increase just a little each day, as you would expect. Also, the total bytes are just slightly less than what I get with wget, which makes sense because wget adds a ".listing" file to each directory. But I'm not familiar with any of this stuff so I really appreciate your . If you want the entire ncftp.log, I could email it to you. |
|
![]() |
| Outils de la discussion | |
|
|