Operating System - HP-UX
1838458 Members
2982 Online
110126 Solutions
New Discussion

copy home/start up scripts

 
brian_31
Super Advisor

copy home/start up scripts

I have two machines A and B. I need to copy the home directories from A to B and also the startup scripts. for the start up scripts i could ftp(hope that would put the links etc). what would be a good way to copy the /home directories?

Thanks

brian
7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: copy home/start up scripts

I guess I would suggest dumping them to tape with tar (-c), then extracting them on the other machine, again using tar (-x).


Pete

Pete
Coolmar
Esteemed Contributor

Re: copy home/start up scripts

For stuff like that I always use "tar" because it keeps all the permissions, etc.

# cd /home
# tar cf - * |ssh machineb "cd /home; tar xf -"

HTH,
James R. Ferguson
Acclaimed Contributor

Re: copy home/start up scripts

Hi Brian:

One way would be to create a 'tar' archive of everything you want; 'rcp' the archive to the second server and un-tar it. 'tar' will handle symbolic links by default. See the 'tar' manpages for more information.

Regards!

...JRF...
spex
Honored Contributor

Re: copy home/start up scripts

Brian,

Just to give you an alternative, you could 'cp -rp /home /mnt/home' over NFS. However, I like the 'tar' method better.

PCS
Bill Hassell
Honored Contributor

Re: copy home/start up scripts

The start/stop scripts are located in /sbin/init.d but the sequencing links are located in several different /sbin directories such as rc0.d, rc1.d, etc. If these two machines are identical (same OS, same applications, same patches) then you can use tar to save just the startup files and links. But you'll also have to save the startup config files located in /etc/rc.config.d, so the tar would look like this:

tar cvf /var/tmp/start.tar /sbin/init.d /sbin/rc?.d /etc/rc.config.d

Then ftp the tar file to system B and untar it there. ftp cannot transfer subdirectories automatically so tar is the choice. But be careful about the OS/apps/patch matching. If they do not match, you'll spend a lot of time cleaning up the bootup errors that will result. It would be a lot better to list the recently added or changed start scripts and links and copy just those specific files.


Bill Hassell, sysadmin
Sp4admin
Trusted Contributor

Re: copy home/start up scripts

Brian,

I Think the best way is to tar them.

tar cf - .|(cd /tmp/tar.test; tar xf -)

But Bill also make a good point.

sp,


Dennis Handly
Acclaimed Contributor

Re: copy home/start up scripts

>sp: tar cf - .|(cd /tmp/tar.test; tar xf -)

There is also a -C option in tar -c so you can be in your target directory and don't need to cd:
tar -cf - -C /old/path | tar xf -