ncftpput and multiple subdirectories ** solved **

Discussion of the Meteohub software package

Moderator: Mattk

Post Reply
sevenless
Gold Boarder
Gold Boarder
Posts: 160
Joined: Wed Jul 02, 2008 7:35 pm
Location: Seattle WA, USA

ncftpput and multiple subdirectories ** solved **

Post by sevenless »

I am attempting to upload groups of graphs into subdirectories on my ftp server based on the time period they display. For instance, I want all graphs showing the last 7 days to be within a subfolder called "myserver.net/week", and all graphs showing the past month to be in "myserver.net/month".

In the Graph Upload section I have specified the subfolders within the file name ( e.g. "week/barometer.png" ) However, the graphs fail to upload even though I have created the subfolders on my server and verified that other graphs without a subfolder direction upload properly.

I have determined the cause of the problem and there are two parts.

1. Based on the logs, the meteograph.cgi process spawns correctly and creates a graph as instructed. However, the cp function and mv function fail to move the newly created image to the /data/myweb/upload folder and /data/upload folder respectively, because the subfolders do not exist. This is easily fixed by logging into the Meteohub server and creating all the necessary subfolders in those two locations, and from that point onward the graphs are created and copied successfully. However, they are still not uploaded to the server.

2. The call to ncftpput fails to upload the graphs within a subfolder because the current design does not instruct the program to recursively upload all files within subfolders. Based on the ncftpput manual, this should be easy to fix by adding the '-R' flag to the PUT call within the Meteohub code. My own testing at an SSH prompt demonstrates that this behaves as expected and all of my graphs upload successfully.

The first problem might be hard to fix within the Meteohub code, so posting my fix here and maybe including a new paragraph in the manual should be sufficient for other users to remedy the issue. However, the second problem cannot be fixed by end users, so can this change in ncftpput behavior be included in a future code update?

Danke schön!
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7953
Joined: Mon Oct 01, 2007 10:51 pm

Re:ncftpput and multiple subdirectories

Post by admin »

Thanks for your analysis which completely makes sense.

I will add the -R option to make your solution work.

However, I would not recommend to go with nested directory structures for uploading, when it can be avoided.
sevenless
Gold Boarder
Gold Boarder
Posts: 160
Joined: Wed Jul 02, 2008 7:35 pm
Location: Seattle WA, USA

Re:ncftpput and multiple subdirectories

Post by sevenless »

I just installed 2.6b (the revised version) and it seems that the recursive upload feature is not working properly. Looking at my system logs I see the ncftpput commands but no -R flag.

Code: Select all

Jul 27 10:45:00 (none) cron.info /USR/SBIN/CRON[2949]: (root) CMD (sleep 96; [ ! -z "`ls /data/uploads/`" ] && /usr/bin/ncftpput -V -DD -u xxxxxxxxx -p xxxxxxxxxx -P 21 xxxxxxxx.com /weather/ /data/uploads/* >>/var/log/messages 2>>/var/log/messages)
Is there a setting I need to activate for recursive uploads?
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7953
Joined: Mon Oct 01, 2007 10:51 pm

Re:ncftpput and multiple subdirectories

Post by admin »

To see a change in the crontab, please press "save" on the "graph upload" page. That will build a new crontab and after that the desired flag should be in there.
sevenless
Gold Boarder
Gold Boarder
Posts: 160
Joined: Wed Jul 02, 2008 7:35 pm
Location: Seattle WA, USA

Re:ncftpput and multiple subdirectories

Post by sevenless »

Re-saving the graph upload page fixed it!

Danke!
Post Reply