LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to make a scheduled backup of repository ,and how to recover it? (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-make-a-scheduled-backup-of-repository-and-how-to-recover-it-895890/)

fabbychips 08-06-2011 06:21 AM

how to make a scheduled backup of repository ,and how to recover it?
 
i need to make a scheduled backup of repository of subversion in ubuntu.
eg,backup the repository at 13.00 pm every Monday
may i need to write some hook scripts to do that?
and i also have to recover the backup of repository
if possible,i want to backup the trunk of repository
my repository is project1
/project1
/trunk
/tags
/branches
any one can give some suggestion?

Annielover 08-06-2011 07:33 AM

You can use crontab to schedule tasks in Linux.

Type the following command:
Code:

sudo crontab -e
At the "command" section you can then write the backup command,
for example
Code:

sudo tar -cvf backup.tar project1/trunk

Annielover 08-06-2011 07:35 AM

Here's a good manual about using crontab.
Code:

http://adminschoice.com/crontab-quick-reference

fabbychips 08-06-2011 10:42 AM

Quote:

Originally Posted by Annielover (Post 4435259)
You can use crontab to schedule tasks in Linux.

Type the following command:
Code:

sudo crontab -e
At the "command" section you can then write the backup command,
for example
Code:

sudo tar -cvf backup.tar project1/trunk

i've typed
Code:

sudo crontab -e
and
Code:

30 23 * * * tar -cvf /home/clx/backup.tar /home/clx/project1
then i type "Ctrl + O" write out ,then exit
i says "crontab:installing new crontab"

but after 23:30 ,i don't see backup.tar in /home/clx
what's wrong ?
i need your help

Annielover 08-06-2011 11:01 AM

You have to restart the cron deamon.
Try
Code:

sudo /etc/init.d/cron restart
OR
Code:

sudo service cron restart

fabbychips 08-07-2011 04:42 AM

Quote:

Originally Posted by Annielover (Post 4435338)
You have to restart the cron deamon.
Try
Code:

sudo /etc/init.d/cron restart
OR
Code:

sudo service cron restart

i've solved it
1 make a script file : backup.sh #(make sure this file has the execute permission)
#! /bin/sh
BDATE=`date +%Y%m%d`
sudo svnadmin dump /home/clx/project1 > /home/clx/backup$BDATE.dump
echo success!

2 in /etc/crontab
0 24 * * * root sudo /home/clx/backup.sh

3 then the backup file backup20110807.dump will be in /home/clx/

4 and recover that backup file :
~$svnadmin create newproject1;svnadmin load newproject1 < backup20110807.dump

but now i want to backup the trunk of my repository.only the trunk,not the whole repository
and the most important ,how to recover the trunk

Annielover 08-07-2011 07:49 AM

make back-up of trunk only:
Code:

sudo tar -cf $HOME/project/trunk
To recover:
Code:

tar -xpf $HOME/FileName.tar
$HOME is a path variable and contains de homedir of the user logged in.
i.e.: /home/annielover


All times are GMT -5. The time now is 05:59 AM.