Shell Scripting for Beginner

hello,

I'm trying to copy all of my home directories to a central location. (daily)

This could be done with a simple cron job. (i know)

If a new home directory is created I would like to copy it's contents without editing the cron job.

What would be the best way to do this?

--
 
Do you want all those directories in the same new directory?

You can just do something like:
Code:
tar cvpf - /usr/home | tar xpf - -C /path/to/other/home
 
forget the first post

Sorry, I'm kind of new to the Unix enviroment. I'm still thinking in 2D and not FreeBSD.

Do I have to learn perl to be a good systems administrator?
 
Use tar as shown above, cp will screw up any hard and softlinks.
 
Also, for keeping the permissions when using cp, you should use "cp -a".
 
Just_Johnny said:
Sorry, I'm kind of new to the Unix enviroment. I'm still thinking in 2D and not FreeBSD.

Do I have to learn perl to be a good systems administrator?
You really don't have to, but it depends upon what you're needing/wanting to do. It's not going to hurt if you do learn it, but probably, sed, grep, xargs and awk, would make a much bigger difference for most people. And there again you don't necessarily need to get very deep in order to get a lot out of it.
estrabd said:
Use rsync, even if the location is local.
I tend to use rdiff-backup for that sort of thing, seems to work fairly well.
 
hedwards said:
You really don't have to, but it depends upon what you're needing/wanting to do. It's not going to hurt if you do learn it, but probably, sed, grep, xargs and awk, would make a much bigger difference for most people. And there again you don't necessarily need to get very deep in order to get a lot out of it.

I agree that one doesn't need to learn Perl to be a good sysadmin, but it is a useful language to know once you've gotten familiar with the set of tools at your disposal and wish to start building tools that are not appropriate for shell scripting and the standard utilities.
 
Back
Top