ncftpput and multiple subdirectories ** solved **
Posted: Tue Jul 22, 2008 7:03 am
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!
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!