You could create a simple ftp-script. It should remove the current content of server 2 and copies all the new content from server 1 to server 2.

You can choose to call this program from inside your cgi-app or through a schedular, depending on when you want your update to be done.

Update

There is another quick solution along the lines of:

[user@server1]$ tar -czvf - web/ | ssh user@server2 'rm -rf web/ ; tar + -xzvf -'

From man ssh to login without a password::

ssh implements the RSA authentication protocol automatically. The user creates his/her RSA key pair by running ssh-keygen(1). This stores the private key in $HOME/.ssh/identity and the public key in $HOME/.ssh/identity.pub in the user's home directory. The user should then copy the identity.pub to $HOME/.ssh/authorized_keys in his/her ho +me directory on the remote machine (the authorized_keys file corresponds +to the conventional $HOME/.rhosts file, and has one key per line, though +the lines can be very long). After this, the user can log in without givin +g the password. RSA authentication is much more secure than rhosts authe +n­ tication.

This has a few advantages:


In reply to Re: perl script accesing another server by wine
in thread perl script accesing another server by philbe

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.