Backup script

Jeff Vian jvian10 at charter.net
Mon Mar 13 03:35:28 UTC 2006


On Sun, 2006-03-12 at 23:12 +0000, Chris Norman wrote:
> Hi people,
> I want to make a script that will b ack up users' home directories.
> 
> I know how to make a tar ball, but I only want the script to run once every 
> week (I think with a cron job, but don't know how to do this), and I want it 
> to use the name of the directory as the tar ball. So, if I have /home/chris, 
> it will use /backup/chris.tar.tar. I also want it to check the time stamps 
> of each file in the backup directory, and if they are over a month old, 
> delete them. How would I implement this?
> 
> I don't want the script written for me, just the knowledge to get started, 
> articles, tutorials and stuff.
> 
in general, write the script to do an ls of the /home directory to get
the user accounts to do a backup on.
then once you have that variable saved, use it to name the file and run
the tar command.
do the tar command in a loop so it can do the same for each needed
directory.

something like
----------------------
cd /home
for file in `ls`
do
   { put your tar commands here using $file as the input directory
        and output file name
   the output file can be written anywhere you choose.}
done
----------------------
should do it nicely.

> Cheers for that,
> 
> Chris Norman
> <!-- chris.norman4 at ntlworld.com --> 
> 




More information about the fedora-list mailing list