[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

backing up several machines to one tape?



    Date: Thu, 29 Apr 1993 22:26-0000
    From: Neal Feinberg <nealf@harlequin.com>

   [...]

    I bet you really want to write some script which will automatically
    dump all three LMFSii without any operator intervention.
    Unfortunately, I don't know of any such batch facility.  Perhaps
    someone else on SLUG has already hacked up something.  Failing that,
    you could try to read the LMFS sources.  There is some good stuff in
    there.

Here's something I hacked for someone to let them backup their
LMFS at off peak time (i.e. when no-one was around).  Of course the backup
has to fit on one tape, but that's not normally a problem with exabyte.
I guess it should be possible to dump 3 LMFSii if two of the machines
specify :TRY-APPEND T, though I've never tried appending LMFS backups so I've
no idea whether that will work.  Also you might need to hack things to handle
any queries that the :TRY-APPEND T option might throw at the operator.

;;; -*- Mode: LISP; Syntax: Common-lisp; Package: USER; Base: 10 -*-

1;;; This kludge is to stop the standard questions about "Is this tape really ...?"
0(defvar 2*deal-with-bot* 0T)

(si:advise-permanently lmfs:backup-deal-with-bot :around
		       dont-query-about-tape-id-if-auto-dumping nil
  (if *deal-with-bot*
1      ;; Do the normal thing
0      :do-it
1      ;; Assume tape OK - just rewind it
0      (send lmfs:*backup-stream* :rewind)))


1;;; Now for the actual backup@10pm part.
;;; The dump had better all fit on one tape!!
0(defvar 2*LMFS-Dump-Timer-Run-Time*0 "10:00 pm")

(defvar 2*LMFS-Dump-Timer*
0	(process:create-timer-call
	  'run-lmfs-dump-timer
	  ()
	  :name (format nil "LMFS Dump @ ~\\time\\"
			(time:parse-universal-time *LMFS-Dump-Timer-Run-Time*))))
			
(defun 2run-lmfs-dump-timer 0()
  (let ((*standard-output* #'sys:null-stream)
	(*error-output* #'sys:null-stream)
1	;; 4 = new version, 3 = 7.2 format - change this to 3 if not using Exabyte tapes
0	(lmfs:*current-backup-tape-version* 4)
	(*deal-with-bot* nil)
	(tape-name (multiple-value-bind (nil nil nil day mon)
		       (time:decode-universal-time (get-universal-time))
		     (setq mon (substring (time:month-string mon) 0 3))
		     (format nil "AD-~A~D" day mon))))
    1;; Schedule the next one now.
0    (reset-LMFS-Dump-timer (time:parse-universal-time *LMFS-Dump-Timer-Run-Time*))
    1;; Now do the backup
0    1;; Here are the list of valid keyword args to 0lmfs:backup-dumper
    1;; 0:spec :tape-spec
    1;; 0:host :tape-host
    1;; 0:drive :unit :tape-drive
    1;; 0:density
    1;; 0:set-dates
    1;; 0:tape-name1 0:reel1 0:reel-id
    1;; 0:end-action
    1;; 0:dump-type
    1;; 0:pathnames1 0:start-node1 0:start-path
    1;; 0:consolidation-time
    1;; 0:operator
    1;; 0:deleted
    1;; 0:try-append
    1;; 0:comment
    1;; 0:query
    1;; 0:restart-path
    1;;
0    (fs:with-automatic-login-to-sys-host
3     ;; Edit the arguments below to reflect the appropriate settings for your site.
0      (lmfs:backup-dumper :tape-spec "local:scsi1"
			  :set-dates T
			  :tape-name tape-name
			  :end-action :rewind
			  :dump-type :complete  1;0 1or :incremental or :consolidated
0;			  :consolidation-time (- (time:get-universal-time)
;						 (si:parse-interval-or-never "1 week"))
			  :pathnames '("local:>**>*.*.*")
			  :operator zl:user-id
			  :set-dates t
			  :deleted t
			  :try-append nil
			  :comment (format nil "Autodump @ ~\\datime\\")
			  :query nil)
1      ;; Log the output of the compare so administrator can check it all dumped OK
0      (fs:create-directories-recursively
	(fs:parse-pathname ">reload-logs>reloader.log" net:*local-host*))
      (with-open-file (*standard-output*
			(send (fs:parse-pathname ">reload-logs>reloader.log" net:*local-host*)
			      :new-name (format nil "Reload-~A" tape-name))
			:direction :output)
	(let ((*error-output* *standard-output*))
	  (lmfs:reloader :compare :tape-spec "local:scsi1"))))))

(defun 2reset-LMFS-Dump-timer 0(time-to-run-next)
  (process:reset-timer-absolute *LMFS-Dump-Timer* time-to-run-next)
  (setf (process:timer-name *LMFS-Dump-Timer*)
	(format nil "LMFS Dump @ ~\\time\\"
		(time:parse-universal-time *LMFS-Dump-Timer-Run-Time*))))

1;;; Interface for controlling the timer

0(define-cp-command 2(com-Start-Periodic-LMFS-Dump :command-table "USER")
0    ((first-time-to-run 'time:universal-time
	     :default (time:parse-universal-time *LMFS-Dump-Timer-Run-Time*)
	     :prompt "Time for the next LMFS Dump"))
   (reset-LMFS-Dump-timer first-time-to-run))

(define-cp-command 2(com-Stop-Periodic-LMFS-Dump :command-table "USER")
0    ()
   (process:clear-timer *LMFS-Dump-Timer*))