Linux script to create weblinks

Please post here if you have problems in using Wing FTP Server.
Post Reply
eordona
Posts: 55
Joined: Fri Aug 24, 2012 5:42 pm

Linux script to create weblinks

Post by eordona »

Hi! I am trying to AUTOMATICALLY create weblinks / download URLs on our Linux system via a shell script. I need this to be non-manual / fully automatic. Here is what I am doing:

1. I create a random 32 character weblink filename (using characters a-f and 0-9 to match the current format) in the ~/wftpserver/Data/_WEBLINK directory

2. I populate the new weblink file with just three lines:
$FULLPATH/$FILENAME
-1
-2040421925

3. I then create the download URL in the following format:

https://$OURDOMAIN/main.html?download&weblink=$WEBLINKFILENAME&realfilename=$FILENAME" rel="nofollow

(Where the capitalized $ values are our specific values)

All of the permissions & ownerships match those created manually via the web interface.

However, my my process isn't working. I get a "No webpage was found for the web address" / 404 error on the links that I create.

From what I can tell, my process is doing what the web interface process is doing... or is there something else that needs to be done to get the weblinks to work?

Thank you very much!!
eordona
Posts: 55
Joined: Fri Aug 24, 2012 5:42 pm

Re: Linux script to create weblinks

Post by eordona »

Any feedback on this? Directionally is what I am trying to do achievable?
eordona
Posts: 55
Joined: Fri Aug 24, 2012 5:42 pm

Re: Linux script to create weblinks

Post by eordona »

Is this site still active? Anyone there?
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Linux script to create weblinks

Post by FTP »

OK, just make sure the Weblink filename is a 32-byte length string.
eordona
Posts: 55
Joined: Fri Aug 24, 2012 5:42 pm

Re: Linux script to create weblinks

Post by eordona »

OK, thank you I will double check that.
eordona
Posts: 55
Joined: Fri Aug 24, 2012 5:42 pm

Re: Linux script to create weblinks

Post by eordona »

OK I figured it out. One has to build the weblink file using CR/LF (carriage return / line feed) in the Windows style, not just CR in the Unix style. I did this in my script by using echo -e and \r and \n:

echo -e "$FULLPATH/$FILENAME\r\n-1\r\n-2040421925" > ~/wftpserver/Data/_WEBLINK/$WEBLINK

Thanks again.
eordona
Posts: 55
Joined: Fri Aug 24, 2012 5:42 pm

Re: Linux script to create weblinks

Post by eordona »

It looks like maybe you have changed things since v.6.1.3 -- (Maybe in 6.2.2: Added a feature - Added Weblink Manager for managing the download links and upload links.)?? My initial testing of 6.2.5 shows that my process (as outlined above) no longer works... can you please tell me how I can manage this? I used to be able to insert the valid file into the _WEBLINK directory, but now that seems to no longer work. The error I get in my browser for my URLs is: The weblink url does not exist. Help please!
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Linux script to create weblinks

Post by FTP »

Yes, the weblink rule changed, please email us for more information.
eordona
Posts: 55
Joined: Fri Aug 24, 2012 5:42 pm

Re: Linux script to create weblinks

Post by eordona »

Thanks... I just did (to the support email)!
Post Reply