I got a few questions about using FTP in a script in QNX4.
How do you get a list of files to download?
I’m guessing the answer will be
Dir PATH fileouput
if that the case
How do you open the output file to get the name of each file found?
I’m trying to write an application on a client machine that will be looking for update on a server machine. I’m planning to use an archives file with a tar extension and the the filename will be created with the following
Filename : MachineName-SoftwareVersion.tar
Client will check for update once week and every reboot.
I will be checking for the Software version to prevent multiple install
This will automatically log in with the username and password on server and download a listing of all files that end in .tar and place them in a file on your local machine called myUpdateFiles. Note you fill in username, password and server with the username, password and IP/DNS name of the server.
Then you can parse myUpdateFiles as you described looking for a newer update. If you find it, you can then download it using another similar system call and install.
This can probably be made more elegant but it does what you need which is getting a file listing on the server of the tar files available.
I’m experiencing on a long delay while using FTP when the server is down.
Any work around for that?
When the system is booting i’m lauching the FTP script. If the server is up then everything is fine but if down. My application will start only after the timeout expired which is way too long. Also how do handle error related to user/password?
I have decide not use the application to check for update. So how do you parse the file list in a script?
Also the archives cksum will be part of the archive filename
How do you cmp the result of cksum with a variable?
Right know i’m using something like
Not sure why it’s not working from an application. There’s no reason for it not to unless you did indeed mix up the < > signs.
The long delay your experiencing when the server is not there is a function of the TCP/IP stack. I’m not sure if you can change the default timeout. I took a quick look in the doc’s and didn’t see it but there should be a way to lower it.
As for the scripting question, yes, there is a way to do what you want. Maybe someone can chime in with the answer to that. I’d need to look it up in the doc’s (I think it’s under ksh) as it’s not in the top of my head.
The alternative is to use the code base Mario mentions. I’ve never used it myself.