1847197 Members
3083 Online
110263 Solutions
New Discussion

script to copy

 
SOLVED
Go to solution
Madhu Sudhan_1
Respected Contributor

script to copy

Friends,
Our users always copy files (20gb +) from one machine to other. They do this copy as non-root user. I would like to facilitate them with a script or program that ensures following
1) Check space availablity on the target machine for a sucessful copy.
2)Which file is being copied and how many files are left to copy.( Continuous Update)
3)Space available one the target (Continuous update)
4)a log which tells which files were unable to copy and for what reason.

Basically I require your valueble inputs on
1) Do I need to write a C-program or a Shell Script will do for this.
2) How can I make this script work for flavours like HP, Sun, Linux.

If you already have some kind of script which does any of the above, I can customize it suit my environment.

Thanks,
Think Positive
5 REPLIES 5
Steven Sim Kok Leong
Honored Contributor

Re: script to copy

Hi,

Will you be considering NFS?

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
Madhu Sudhan_1
Respected Contributor

Re: script to copy

Steven,
Will there be any problem with links if I use nfs ?

Thanks,


Think Positive
Steven Sim Kok Leong
Honored Contributor

Re: script to copy

Hi,

What sort of links are you referring to?

What is the intention of this regular file transfer ie. as a central storage area so that the local storage can be freed? That will decide whether NFS would be suitable for your scenerio.

If these files need to be accessed by the same person who uploaded it later in time, NFS and NIS would be appropriate, with respect to ease of use for the user and ease of maintenance for the administrator.

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
Madhu Sudhan_1
Respected Contributor

Re: script to copy

Steven,
Iam refering to symbolic or hard links.

The pupose of this copy is to clone Oracle Apps from Production to Test to test out patches etc.,

Regards,
Think Positive
Steven Sim Kok Leong
Honored Contributor
Solution

Re: script to copy

Hi,

One way is to use dual links (pvlinks) to mirrored LVs. Resynchronize the LVs with their mirrors once a day from the production system to the test system via the links. Keep the mirrors split for the rest of the day. However, initial setup can be quite tedious unless the test machine is the exact same configuration as the production (eg. no. of disk controllers).

For the script method if you insist on it,

1) Check space availablity on the target machine for a sucessful copy.

You have to use a combination of bc or awk (for summing up the sizes) and SSH to connect to the target machine to perform a bc or awk on the target machine.

2)Which file is being copied and how many files are left to copy.( Continuous Update)

SCP gives you a continuous update via a progress bar as the transfer takes place. So does NCFTP. Both does not come default with HP-UX.

4)a log which tells which files were unable to copy and for what reason.

Check the exit code of the SCP command and for each exit code, echo a detailed explanation of the error.

1) Do I need to write a C-program or a Shell Script will do for this.
2) How can I make this script work for flavours like HP, Sun, Linux.

A shell script needs only a shell interpreter. A C program still needs compilation on the target system if it is a different platform and version (re-compilation). Personally, I prefer a shell script because it is more flexibile and portable (works with the built-in shell interpreter on all HP, Sun and Linux platforms).

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com