The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to transfer a directory??

Discussion in 'General Discussion' started by junglecat, Mar 9, 2005.

  1. junglecat

    junglecat Well-Known Member

    Joined:
    Jul 6, 2004
    Messages:
    168
    Likes Received:
    0
    Trophy Points:
    16
    Here's a good one. I have a client on one server who wants me to move a perl script to an account on another server. (I have root access to both servers).

    How do I move just the cgi-bin directory from one account to another via ssh?

    I have a vague idea of how to do it, but afraid to try without instructions from an expert.
     
  2. lloyd_tennison

    lloyd_tennison Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    698
    Likes Received:
    1
    Trophy Points:
    18
    Simplest would just be ftp. Just set permissions the same on the old as the new. Then no worring about ownership, etc.
     
  3. junglecat

    junglecat Well-Known Member

    Joined:
    Jul 6, 2004
    Messages:
    168
    Likes Received:
    0
    Trophy Points:
    16
    This needs to be done via ssh.
     
  4. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Why does it "have" to be ssh? It can be done as mentioned through FTP and is fairly simple.
     
  5. junglecat

    junglecat Well-Known Member

    Joined:
    Jul 6, 2004
    Messages:
    168
    Likes Received:
    0
    Trophy Points:
    16
    Because every time I've tried moving this particular script (smartsearch) via ftp it gets totally screwed up and doesn't work right. And this customer has had a bunch of custom addons added to it.
    I've gotten paranoid about how I move smartsearch scripts.
    I've moved entire sites using it via whm with no problems at all.

    And then there's the fact that I'm on dialup (all I have out here in the boonies), and moving a large directory will take a loooooooooonnnnngggggg time via ftp. :(
     
  6. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Try something like the following, tar ftp untar. Crude but should work. (Sorry syntax's may not be 100%)

    Server where script is;

    tar -cvf directory.tar directory

    sftp server2
    cd location
    put directory.tar


    ssh to server2

    cd location
    tar -xvof directory.tar

    chown as needed
     
  7. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    If you find Perl scripts are getting broken when uploading through ftp, check how you're uploading them - ascii mode will work fine, binary mode will break them nicely.

    I know its not quite the answer you're looking for - somewhere in the middle on a scale of 1 to 10 for useful suggestions but still worth considering.

    If you do go for the option of uploading the scripts via FTP try this to check if the scripts are being uploaded using binary mode (if you can't otherwise tell):

    1) Upload one script
    2) Open it with a text editor from the server (pico or similar)
    3) If it is readable, all is OK. If it is a bunch of nonsensical characters, it has been corrupted due to being uploaded in binrary mode

    What FTP client are you using?
     
  8. DigitalN

    DigitalN Well-Known Member

    Joined:
    Sep 23, 2004
    Messages:
    420
    Likes Received:
    1
    Trophy Points:
    18
    If the account UID/GID is the same on each server (otherwise just chown them once transferred)

    # rsync -avz -e ssh root@host.domain.com:/home/$user/public_html/cgi-bin /home/$user/public_html/

    or

    # rsync -avz -e ssh /home/$user/public_html/cgi-bin root@host.domain.com:/home/$user/public_html/

    Depending upon which server you are in :)

    Of course you could just use sftp instead or plain old ftp.
     
    #8 DigitalN, Mar 10, 2005
    Last edited: Mar 10, 2005
  9. DigitalN

    DigitalN Well-Known Member

    Joined:
    Sep 23, 2004
    Messages:
    420
    Likes Received:
    1
    Trophy Points:
    18
    You said you had access to both servers - why are you downloading the files and then uploading them again?

    Just login to your server and use sftp or ftp via command line

    # ftp your_other.server.com

    or

    # sftp your_other.server.com

    If using root, you are best to not to use ftp however. The rsync commands will be fine.
     
Loading...

Share This Page