SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Sponsored Links

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files
* Backup v3.0 *

Author: loop <loop@foc.dyndns.org>
URL: http://foc.neoartis.org
Project page on Freshmeat: http://freshmeat.net/projects/loopbackup/

Description

Script to backup system directories, files and configurations, specified in the configuration file (backup.conf). It's highly configurable, you can automate the task adding it to your crontab (it MUST be run as root, because it has to be able to access the whole box disk(s)).

Features
  • Several combinable options for choosing the destination of the backup: SAMBA (NETBIOS), FTP, SCP (SSH), tape (DAT), CDR(W) and HD (tarballs or ISO image).
  • In the case you choose to only create an ISO, you can pass external commands to manage it.
  • Option to encrypt (blowfish) the backup files.
  • Option to choose the compression format: gzip or bzip2.
  • In the case you choose CD as destination, it checks that the size of the backup's ISO Image isn't greater than the CD's capacity.
  • Checks if the backup has been successfully saved/transfered to the HD, CD, tape, SAMBA or SCP.
  • Option to specify how many old backups should be kept in local harddisk or remote SAMBA, FTP or SCP servers.
  • System backup: /boot, /etc, /usr/local/etc, crontab, installed packages, kernel configuration, system information and system logs.
  • Homes backup: /root, the whole 'home' directory (w/ user-defined excluded paths) or selective homes.
  • Common software backup: Sendmail, Apache, PHP, MySQL, Squid, MRTG, Majordomo, Mailman, GNUPG, AWStats, Nagios (NetSaint), MailScanner. All PATHs are configurable.
  • Custom directories backups/listings.
  • E-mail notification: it sends the final status of your backup in the subject (OK/ERROR) and the full log in the body.
  • Language: spanish or english, with easy translation to others.
Requirements
  • Basic utilities: cp, rm, ls, tar, gzip, cat, date, uname, lspci, df, ps, netstat, fdisk, ifconfig, awk, sed, cut, wc, head, tee, mail. All these utilities must be within your $PATH environment variable.
  • Perhaps you need some other utilities (according to the options you choose). The PATH to that utilities must be set in your configuration file: smbmount, mkisofs, cdrecord, mt-st, gpg, mysqldump, openssl.
Installation

1.- Move the whole directory of the script to /usr/local/backup:

# mv backup-version /usr/local/backup Or, you can move it with it's version and do a symlink...

# mv backup-version /usr/local/ # cd /usr/local # ln -sf backup-version backup

        2.- Edit the file configure it to fit your needs and save it as 
            'backup.conf'. This file is in /usr/local/backup/etc directory.
                - backup.conf-dist-en => english version
                - backup.conf-dist-es => spanish version

        3.- Check all the backup's files permissions. If you did a 'mv', they 
            should be OK. ;)
            The owner and group of all the files must be root:
                # chown -R root.root /usr/local/backup
            The file 'backup.sh' must be readable, writable and executable ONLY
            by root:
                # chmod 700 /usr/local/backup/backup.sh
            The configuration file must be readable and writable ONLY by root:
                # chmod 600 /usr/local/backup/etc/backup.conf
            You should get something like this:
                -> -rwx------   root    root    backup.sh
                -> -rw-------   root    root    etc/backup.conf

        4.- If you want to run it as a cron job, you can use this example:
                # crontab -e
                  -> # Do backup on Mondays (1 AM)
                     0 1 * * mon      /usr/local/backup/backup.sh 1> /dev/null 2>/dev/null
                We redirect the program output to /dev/null ("1> /dev/null 
                2>/dev/null"), because we don't want cron to send us an
                e-mail containing the stdout of the program. The script keeps us
                informed by itself.

        5.- If you want to run it right now:
                - Having /usr/local/backup within your PATH:
                # backup.sh
                - Without having it there:
                # /usr/local/backup/backup.sh

You can specify a different configuration file to be read by the script. This can be useful in the case you make several kinds of backups in the same machine. The alternative(s) config file(s) MUST BE within /usr/local/backup/etc directory, so you don't need to specify a PATH:

# /usr/local/backup/backup.sh -c backup-other.conf

If you pass no argument to the script, the configuration file located at /usr/local/backup/etc/backup.conf will be read.

I recommend you to run it at least once in real-time (typing the program name in your shell, not from cron) after you configured it, before you put it in the crontab, just to be sure that it'll run successfully.

Enjoy it! ;)


Sponsored Links

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.