Solved

back up homre directory on debian

Posted on 2006-06-27
2
233 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
[X]
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
  • 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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses

623 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