Solved

back up homre directory on debian

Posted on 2006-06-27
2
225 Views
Last Modified: 2013-11-15
Are there any method to backup /home dirdctory to another hardisk every day by change the name of target everyday after
3 day then replace the old one   i run on debian


suchas

 on 1 jul backupas          01.tar
on 02 jul back up as        02.tar
on 03 jul backup as          03.tar

on 04 jul backupas          01.tar
on 05 jul back up as        02.tar
on 06 jul backup as          03.tar

Thank
0
Comment
Question by:teera
  • 2
2 Comments
 
LVL 22

Accepted Solution

by:
pjedmond earned 450 total points
ID: 16995609
Assuming that your remote directory is mounted in some way, then:

----------8X----------------------------
#!/bin/bash
NAME=`ls -act /backup/dir | grep *.tar | tail -n1`        #This finds the oldest tar file in /backup/dir
tar -cvf /backup/dir/NAME /home                                #This backs up the home directory
----------8X----------------------------

You need to 'prime' /backup/dir as follows:

touch /backup/dir/01.tar
touch /backup/dir/02.tar
touch /backup/dir/03.tar

Oldest file will then initially be 01.tar for first backup etc.

Finally, add the above script to your crontab, in order to ensure that it runs once per day at a suitable time:

12 12 * * * /dir/to/myscript.sh

(   (()
(`-' _\
 ''  ''

0
 
LVL 22

Assisted Solution

by:pjedmond
pjedmond earned 450 total points
ID: 16995617
Ooooops - change script to:

----------8X----------------------------
#!/bin/bash
NAME=`ls -act /backup/dir | grep *.tar | tail -n1`        #This finds the oldest tar file in /backup/dir
rm -Rf /backup/dir/NAME                                            #Remove the old file!
tar -cvf /backup/dir/NAME /home                                #This backs up the home directory
----------8X----------------------------
(   (()
(`-' _\
 ''  ''
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

After running Ubuntu some time, you will be asked to download updates for fixing bugs and security updates. All the packages you download replace the previous ones, except for the kernel, also called "linux-image". This is due to the fact that w…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now