Read a file on server A write to server B

I want to pick up series of files from a file production server and move extracts to development server nightly. Servers are IBM running db2. I can use native drivers or ODBC.

I was thinking about using php. One option was to iterate through source file and insert to development server. Another idea was read source file into array and then iterate array and write to development server.

Any other approaches?

Upvotes: 1

Views: 219

Answers (2)

Garrett Bluma
Garrett Bluma

Reputation: 1312

If the PHP script is going to run for a while, I would recommend not using it. PHP is notorious for memory usage (due to poor garbage collection). I mention this because I recently had to do something similar and bailed on PHP for this task.

Opinion aside, the best solution would probably be to mount the remote file system (via NFS, SMB, etc.) on the local system (as a folder) and just copy the files like you would from one folder to another. Unless you're processing the files as you copy them, a scripted solution doesn't seem like the best approach.

Other great options include rsync, scp, and to a lesser extent FTP.

Upvotes: 0

haknick
haknick

Reputation: 1920

A shell script would be much more feasible to do this assuming your IBM servers are running a *Nix flavor.

Upvotes: 1

Related Questions