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.

can some one improve this command please

Discussion in 'General Discussion' started by sleuth1, Oct 29, 2003.

  1. sleuth1

    sleuth1 Well-Known Member

    Joined:
    Mar 16, 2003
    Messages:
    75
    Likes Received:
    0
    Trophy Points:
    6
    Hi this command works fine to quickly move a useraccount from one server to another with root ssh on both machunes , problem is is creates spagghetti in the the /home/ directory of the server it is being copied to , that is is unzips straight into home itself , I want to preserve the account as a directory , can any one who knows their commands improve this , I have tried a couple of changes and just get ( cowardly refusal .. ) ( no tty ..) etc The thing is it can move 100 mb in a few minutes , so it could be a good tool ..

    (cd /home/username/; tar -czpf - .) | ssh -l root hostIP "(cd /home/; tar -xzpvf - )"

    #all one command on one line
    #will ask for root password of destination machine
     
  2. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    I don't know, but how about
    cd /home; tar -czpf username

    Sorry, probably useless, but I figured I'd try.:)
     
  3. sleuth1

    sleuth1 Well-Known Member

    Joined:
    Mar 16, 2003
    Messages:
    75
    Likes Received:
    0
    Trophy Points:
    6
    Thanks for the input casey , I may have already tried that but i will give it a go and see what gives.
     
  4. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    The following, although a simplyfied example, is a good method for a manual Server-to-Server transfer, but there are some caveats.

    Sending Server
    cd /home; tar czvf accountID.tar.gz accountID; scp accountID.tar.gz root@receivingserver.com:/home/yourtmp

    Enter root PW for receiving Server when asked.

    Receiving Server
    cd /home/yourtmp tar xzvf accountID.tar.gz


    Although one can do a transfer/install with a one line command, it is not advisable. It is also wise to always transfer to a tmp dir. on the receiving Server to unpack, then copy to the 'home' dir. This way, if there is a problem, you have the originally transferred file(s) in case of any file corruption and don't have to do another transfer.

    The above does not include transfer of various files; i.e., domlogs, mysql db's or anything else not in the accountID dir. It also presumes the Receiving Server does not already have an accountID by the same name. If one only wants to transfer what is in the 'public_html' dir. then add that to the above path of the Sending Server.
     
  5. troxalias

    troxalias Well-Known Member

    Joined:
    Nov 21, 2001
    Messages:
    96
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Athens - Greece
    Although i don't like such on liners because they are VERY dangerous here is a slightly modified version of your command that will do the work:

    (cd /home; tar -czpf - ./username) | ssh -l root hostIP "(cd /home/; tar -xzpvf - )"
     
Loading...

Share This Page