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.

Script to copy file btw server

Discussion in 'General Discussion' started by adapter, Dec 1, 2004.

  1. adapter

    adapter Well-Known Member
    PartnerNOC

    Joined:
    Sep 17, 2003
    Messages:
    391
    Likes Received:
    0
    Trophy Points:
    16
    Hi

    i need a script that will copy all my files inside the backup folder to a remote server, i know that there is resync but i prefer to get a script in perl or php that will upload only the tar files via ftp on my second server, any help?
     
  2. elleryjh

    elleryjh Well-Known Member

    Joined:
    Apr 12, 2003
    Messages:
    479
    Likes Received:
    0
    Trophy Points:
    16
    If you have ncftp, you can use the ncftpput command to upload your files. Then just put the command in your crontab.

    It would be something like this:

    ncftpput -u yourusername -p yourpassword backupserver.com "/backups/" "/backup/cpbackup/daily/*"

    Probably also good to nice it. When I did this, it was eating up a lot of my cpu time.

    nice +19 ncftpput -u yourusername -p yourpassword backupserver.com "/backups/" "/backup/cpbackup/daily/*"


    For ncftp: http://www.ncftp.com/download/
    Make sure to get the client, not the server.
     
  3. Roy@ENHOST

    Roy@ENHOST Well-Known Member

    Joined:
    Mar 5, 2002
    Messages:
    495
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Los Angeles California
    It will be nice (no pun intended) to have a documentation for the NICE.
    What is +19 and how do we make sure that it consumes minimum CPU resources while its doing its job?
     
  4. elleryjh

    elleryjh Well-Known Member

    Joined:
    Apr 12, 2003
    Messages:
    479
    Likes Received:
    0
    Trophy Points:
    16
    nice +19 changes the nice value of the command that follows it. Nice is the NI value in top and ranges from -19 (near full CPU) to +19 (low cpu usage). [yes, neg numbers are high and pos numbers are low].

    Processes are usually run at 0. Only root can increase the nice value of a process, but anyone can decrease a process that they own.

    Also see "man renice" for information about changing nice values of a running process.

    PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
    12109 root 31 15 22976 18M 1548 S N 2.7 3.7 1:00 0 spamd

    From "man nice":

     
  5. Roy@ENHOST

    Roy@ENHOST Well-Known Member

    Joined:
    Mar 5, 2002
    Messages:
    495
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Los Angeles California
    For some reason I can't run NICE on my box.
    Do we need to install it or its already there as default??
     
  6. elleryjh

    elleryjh Well-Known Member

    Joined:
    Apr 12, 2003
    Messages:
    479
    Likes Received:
    0
    Trophy Points:
    16
    What are you running? I thought it was standard with just about everything. Mine's located at /bin/nice. Got anything there?
     
Loading...

Share This Page