View Single Post
  #3   (View Single Post)  
Old 29th November 2010
thirdm thirdm is offline
Spam Deminer
 
Join Date: May 2009
Posts: 248
Default here's what I do

This is my back up script I use at home that uses dump on OpenBSD. If you can figure out scsh, maybe it will help you. Or if someone else reads scheme, maybe he or she will notice something I'm overlooking. I find dump a little intimidating myself, or at least thinly documented, though this script does create a backup that I can see interactively with restore. You probably want to ignore the dump level command line argument I allow, since I haven't thought through how that would work with the file name I write to yet (if you think about it, you'll see it wouldn't be a good idea to supply an argument other than 0 to my script).
Code:
#!/usr/local/bin/scsh -s
# Back up important file systems to poe using dump.
# Pass the dump level on the command line (0-9).
!#

(define (suffix mnt-point)
  (if (string=? mnt-point "/")
      "_root"
      (string-map (lambda (c) (if (char=? c #\/) #\_ c))
                  mnt-point)))

(for-each
 (lambda (mnt)
   (run
     (|
       (/sbin/dump -h0 -u
                   ,(string-append "-" (arg command-line-arguments 1 "0"))
                   -f -
                   ,mnt)
       (ssh "-i" /home/thirdm/.ssh/id_rsa
            thirdm@192.168.2.2 dd ,(string-append "of=backups/holly_backup"
                                                  (suffix mnt)
                                                  ".dmp")))))
 '("/" "/home" "/var" "/usr/ports"))
Reply With Quote