FTP issue

Discussion of the Meteohub software package

Moderator: Mattk

Post Reply
Simon
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: Tue Aug 24, 2010 11:45 pm

FTP issue

Post by Simon »

Hi there,

I'm running the latest s/ware on an NSLU2 and have had nearly a year of trouble-free running until yesterday...

I've read through the previous posts where people have had some issues with FTP uploading and checked I'm not suffering the same issues (invalid sensors, correct FTP credentials, etc) and I can't see any problem. Everything was working well until 24 hours ago.

If I do an FTP test, the test file appears on my host server immediately, no issues. However none of my scheduled FTP uploads (graphs, WD and test-template.html) have happened since the morning of the 23rd August. Rapid fire to Weather Underground and other networks is fine. The copies saved to the mywebs directory are all spot on and updating as they should - they are just not being sent out via FTP. I've checked and re-checked everything but can't see what I've missed. Any help really appreciated. :?:

Simon
Simon
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: Tue Aug 24, 2010 11:45 pm

Re: FTP issue

Post by Simon »

No ideas, then?! I've tried going to the experimental software version, I've tried downgrading again. I've changed my FTP password to something really simple (and much less secure!) just in case, but no luck.

I can't understand why I can send an ftp test file no problem, but no scheduled FTP events seem to have happened since the 23rd August. What have I missed? Help! :cry:

Simon
User avatar
YJB
Platinum Boarder
Platinum Boarder
Posts: 387
Joined: Thu Feb 19, 2009 5:53 pm
Location: Venhuizen, Netherlands
Contact:

Re: FTP issue

Post by YJB »

Hi,

I'm not seeing any ftp problems on the 4.6m release, but since you do have issues, have a look at this (assumes you have login access to meteohub and have a basic understanding of *NIX).

This is the basic process:

Every minute a cronjob (at hh:mm:35) checks the /var/run/meteohub/uploads/ directory for the presence of files and if it find files they will be send to their destination
1) Check if this is really scheduled (crontab -l |grep ftp)
2) Check if the ip address in the crontab command-line is correct (looks like -P 21 192.168.1.101, address might vary)
2) Check if files are appearing in the /var/run/meteohub/uploads/ directory. This will happen throughout each minute and these files should disappear once the ftp job has finished

The /var/run/meteohub/uploads/ gets filled by all kind of cron tasks, but with the information above you can at least check if the ftp part is failing or the actual generation of the files.

Please report back and we take it from there.
Simon
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: Tue Aug 24, 2010 11:45 pm

Re: FTP issue

Post by Simon »

Hi there, thanks for trying to help.

I'm very much a beginner with unix so go easy on me! However, here's the contents of the cron:

*/1 * * * * sleep 35; [ -z "`ls /var/run/meteohub/uploads/`" ] || [ -n "`/bin/pidof /usr/bin/ncftpput`" ] || /usr/bin/ncftpput -S .tmp -R -V -DD -u "********" -p "**********" -P 21 84.40.2.180 www /var/run/meteohub/uploads/* 2>&1 | /usr/bin/logger

(I've masked the username and password with *s obviously!) - does this seem ok?

I've checked the contents of /var/run/meteohub/uploads/ and the files are current and correct (e.g. test-template.html is showing current data right now)

I've re-checked ftp settings again and a meteohub test upload to the server above goes fine, and the test file arrives. Still no graphs or data being uploaded automatically though. :?:
User avatar
YJB
Platinum Boarder
Platinum Boarder
Posts: 387
Joined: Thu Feb 19, 2009 5:53 pm
Location: Venhuizen, Netherlands
Contact:

Re: FTP issue

Post by YJB »

I see 2 options:

There is still a stale ncftpput processing running:
/bin/pidof /usr/bin/ncftpput should not return a PID (and the exit status should be 1 (echo $?)

Otherwise try to upload a file manually using ncftpput:
# echo "hello" > /tmp/ncftpput_test.txt
# /usr/bin/ncftpput -S .tmp -R -V -DD -u "username" -p "secret" -P 21 192.168.1.101 /data/www/default/weather_vars /tmp/ncftpput_test.txt

Also, make sure that on the destination system the user that you are using for ftp has the correct rights, especially for writing in the target directory
Simon
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: Tue Aug 24, 2010 11:45 pm

Re: FTP issue

Post by Simon »

Manual upload using your latter commands worked fine. Still no auto uploads, though.

Don't understand the "stale process" bit.
User avatar
YJB
Platinum Boarder
Platinum Boarder
Posts: 387
Joined: Thu Feb 19, 2009 5:53 pm
Location: Venhuizen, Netherlands
Contact:

Re: FTP issue

Post by YJB »

If you look at the syntax of the entire cron commandline you will see that it is doing 2 checks before launching the ftp command:

The commands are processed from left to right and the 1st part refers to the scheduling of the ftp (which translates to 35 seconds after each full minute)

check 1:
[ -z "`ls /var/run/meteohub/uploads/`" ]
Check if there are no files in /var/run/meteohub/uploads/
(actually it is saying test if the output of the ls command is empty)

||
Means if the previous is not valid perform the next command
(which means if the test fails, which means that there is an output)

check 2
[ -n "`/bin/pidof /usr/bin/ncftpput`" ]
check if there is already a an ncftpput process running
(actually it is checking of the output of the command is not empty)

||
Means if the previous is not valid perform the next command
(which means if the test fails, which means that there is no output)

Sorry about the double negations, but that's the way things do sometimes work
**** END of the code explanation

If you are saying that the ncftpput is working from the commandline
AND
you are saying that there are files in /var/run/meteohub/uploads/
IT SHOULD IMPLY
That there is still another ncftpput process running that is probably in a hang condition (that's what I tried to say with the "stale" expression).

So let's give it a shot, can you run:
# /bin/pidof /usr/bin/ncftpput

If this is gives some output, it implies that there is still a ncftpput processing running. you can also try to issue the following command which will show you how long this command is already running:
# ps -ef |grep ncftpput

If it gives something like:
root 23847 21638 1 15:29 pts/0 00:00:00 /usr/bin/ncftpput -S .tmp *************
you know that an ncftpput process is still running and it started at 15:29
Post Reply