Skip to content

tmartinfr/tobackup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

==========================================
tobackup - A simple unix-style backup tool
==========================================


Description
===========
tobackup is a short script written in sh(1) for performing local or remote
incremental backup over SSH. It aims to keep simple and easy to understand by
following Unix philosophy : use cron(8) for backup scheduling, ssh(1) for
remote data transfer, and rsync(1) for its capability to performs incremental
copy of directories.


Configuration
=============
tobackup is based on a pull model : the backup server is the host which fetch
and store backup, and the backup client is the host which is backuped.
For backuping your local host, use the same steps, and specify 127.0.0.1 for
the _HOST parameter (see below).

Launch the program with no parameters to get help.
In addition, the following steps must be performed.

1) Config file on backup server
  -----------------------------
Default config file on backup server is /usr/local/etc/backuprc. Override this
with the -f flag.

See backuprc.sample in this directory for examples and comments.

2) Configure SSH for a remote backuped host (if necessary)
   ----------------------------------------
Add the SSH key to the .ssh/authorized_keys file of the remote user who
will be used for transfer, with the following options. If root, you may
specify "forced-commands-only" for the PermitRootLogin directive of sshd.

Example (backup server has IP address 1.2.3.4) :

from="1.2.3.4",command="rsync --daemon --server --config /usr/local/etc/rsyncd-backup.conf .",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa XXXXXXXXXXX root@backupserver

3 Configure rsyncd on a backuped host (remote or local)
  -----------------------------------
Add the directories to backup in /usr/local/etc/rsyncd-backup.conf. See
rsyncd-backup(5) man page. Example :

[root]
path=/
read only=yes
use chroot=no
uid=root
exclude = /dev

[usr]
path=/usr
read only=yes
use chroot=no
uid=root
exclude = /ports

4) Launching the script
   --------------------

tobackup takes mainly 3 arguments :

-h HOST1   : use config for HOST1 in config file
DIR        : store backup in DIR
NUMKEEP    : number of incrementals backup to keep in DIR

For example, the command :

$ tobackup -h host1 daily 6

keeps 6 backups in "daily" directory. If you launch this command each day, you
have daily backups of the last 6 days.

5) Scheduling backup on backup server
   ----------------------------------
Scheduling is done using cron(8). Example :

35      23      *       *       1-6     [ $(date +\%d) -ne 1 ] && tobackup -h host1 daily 6
35      23      *       *       0       [ $(date +\%d) -ne 1 ] && tobackup -h host1 weekly 3
50      23      1       *       *       tobackup -h host1 monthly 6

This performs daily backup on the last 6 days at 23:35, from monday to
saturday, weekly backup on the last 3 weeks at the same time on sunday, and
monthly backup on the last 6 months the first day of each month.

Note : You may add the -v switch to get a full listing of file transfers.


Author
======
Thomas Martin <[email protected]>

About

A simple unix-style backup tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages