HowTo Setup on your Linux System

Pete Nesbitt
June 2002

This document should act as a guide to setting up the script in 
order to have your Linux workstation backed up. It will allow you to select 
specific directories to backup on a remote server, (currently a win2000 box), and 
keep a single days copy locally.

The current iteration runs under root. It can also run as the user `backup' in certain 
cases. In order to run as user backup, backup must be a member of the group "disk" 
(at least on RedHat) which will allow access to all files that are not readable only 
by Root. On a single user system, the script could run as the sole user on the system.

This script is not intended for full system wide backup, but as a directory based 
solution. There are problems sending very large files to our Windows 2000 server via 
scp, it fails somewher between 1 & 2 GB. This script sends each directory listed as 
a separate transfer to help eliminate this problem.


1) Ensure that your computer is configured to use unattended scp to transfer files to 
   the backup server. If needed, please read the related document "scp_key_auth.txt".

2) Become the root user:  "su -"

3) Copy the script to /usr/local/sbin or wherever is appropriate for your system.

4) Create a file to hold your target directories:
    "touch /etc/backup_src.txt"

5) Edit the "/etc/backup_src.txt" file and add the target directories. The format is a 
   single directory on each line. No comments and no blank lines. This could be changed 
   if the script was set to ignore commented lines, but that is not currently the case.

6) Edit the "":
   6a) adjust the line:
       to read:
       ie: TARGET_DIR=$TARGET_HOST:e:/bu-rayl

   6b) confirm/correct the location of the binaries used:
        /bin/bash   (should (?) work fine under other common shells)
        /usr/local/openssh/bin/scp  (this one will almost certainly need changes)

7) Have a directory set up on the backup server. This will be the directory referenced 
   above in the TARGET_DIR= line. Please be sure it is on drive "e:" and starts with 
   "bu-" this keeps them all together.

8) We are almost ready to go, but first, lets run a test.
   8a) save the directory_source file.
         "cp /etc/backup_src.txt /etc/backup_src.txt_orig"
   8b) edit /etc/backup_src.txt so it only references a very tiny directory.
   8c) make the script executable if it is not already.
          "chmod 744 /usr/local/sbin"
   8d) run the script: "/usr/local/sbin" or where ever you placed it.
   8e) Presuming no errors, check the size of the output file on your system
       (/tmp/_dir_subdir_subdir.tar.gz) and compare it to the one on the targeted server 
       (backup_nt5:/e:/bu-rayl/_dir_subdir_subdir.tar.gz). There may be a byte or two 
       different due to unit rounding.
   8f) Presuming success, replace your existing /etc/backup_src.txt with the original.
         "cp /etc/backup_src.txt_orig /etc/backup_src.txt" say yes when prompted to 
          over-ride existing file.

9) Add an entry to cron so the script runs each night. We may want to ensure we do not 
   all use the same time (somehow. Maybe conversations?).
    9a) "crontab -e" (This will open your crontab file in 'vi' (or default editor))
    9b) in the crontable file add something like:
        "# script to send backup .gz's to a remote host. June 26 2002. PN"
        "# run daily"
        "10 2 * * 2,3,4,5,6 /usr/local/sbin/"

          This reads "run the script `/usr/local/sbin/' at 10 minutes 
          after 2am on Tues, Wed, Thurs, Fri, & Sat."

10) Exit from su using the command "exit".

11) Your done!!