Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

back up homre directory on debian

Posted on 2006-06-27
2
229 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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.

840 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