in reply to Updating files over multiple servers


Connect to the server.
Get the file to the local machine.
After getting the file to the local machine, delete the file in the server.
Do what ever you want to update in the file, which is now in the local machine
Put the updated file on the server.

This is just a suggesstion or point from my side!!!
  • Comment on Re: Updating files over multiple servers

Replies are listed 'Best First'.
Re^2: Updating files over multiple servers
by apl (Monsignor) on Sep 27, 2007 at 10:02 UTC
    Personally, I wouldn't delete the file on the server until I had the new file ready to ftp back.

    Rather, consider renaming the original server file. This has the added benefits of indicating that the file is being worked on (rather than having been "lost'), giving you something to recover from in case of disaster, and having a touchstone to indicate what changes were made.
Re^2: Updating files over multiple servers
by Anonymous Monk on Sep 27, 2007 at 06:22 UTC
    Ok, but how do I connect TO the other servers?

    right now I update .txt files like this:
    open(FI,">>/home/path/to/file.txt") or die "Oops file failed: $!"; seek(FI, 0, 2); print FI "username /specific/path /something else\n"; close(FI);
    So if I have to duplicate everything to the other servers so that no matter which server the load balancer puts the users on, they have that data available to them, how do I use Perl to Open those files, since they are not on the same server.

    Thanks.
    Richard
    Sorry for the confusion in the first question.
      Hello,

      For most of my machines, I simply connect with telnet, i.e. on Unix/Linux machines. Note that I'm in an internal network, so I'm not confronted with many security issues. It all depends on your network, so YMMV.

      There is a perl Telnet module. You can find the documentation here: Net::Telnet. Connect to each machine, open the file, concatenate, close file. The telnet service on Windows is somewhat more difficult. It's also mentioned in the documentation.

      Also, if you search PerlMonks, you're sure to find examples.

      regexes


      -------------------------
      Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan "press on" has solved and always will solve the problems of the human race.
      -- Calvin Coolidge, 30th President of the USA.