Script to copy file btw server

adapter

Well-Known Member
PartnerNOC
Sep 17, 2003
391
0
166
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?
 

elleryjh

Well-Known Member
Apr 12, 2003
479
0
166
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.
 

[email protected]

Well-Known Member
Mar 5, 2002
487
0
316
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?
 

elleryjh

Well-Known Member
Apr 12, 2003
479
0
166
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":

NAME
nice - run a program with modified scheduling priority

SYNOPSIS
nice [OPTION] [COMMAND [ARG]...]

DESCRIPTION
Run COMMAND with an adjusted scheduling priority. With no COMMAND,
print the current scheduling priority. ADJUST is 10 by default. Range
goes from -20 (highest priority) to 19 (lowest).

-n, --adjustment=ADJUST
increment priority by ADJUST first

--help display this help and exit

--version
output version information and exit
 

[email protected]

Well-Known Member
Mar 5, 2002
487
0
316
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??
 

elleryjh

Well-Known Member
Apr 12, 2003
479
0
166
What are you running? I thought it was standard with just about everything. Mine's located at /bin/nice. Got anything there?