.; INCBUP.IND, IND control file. .; .; Performs an INCremental BackUP, according to the date of the .; previous last backup. .; .; Refer to INDFIL.DOC for instructions and definitions. .; .; First parameter is SOURCE VOLUME .; (If SOURCE is a file name, the LD unit is requested - if it is .; already mounted, that unit is the default). .; Second parameter is BACKUP VOLUME .; (If BACKUP is a LD, a physical device is requested). .; Third parameter is DATE OF BACKUP. .; .; Version 2 gives unique file names to subdevices used for .; backups, so several can be put on one physical device. .; Version 3 now checks disk size to be sure files will fit. .; Version 4 includes cataloging by DSKLIB, and better MULTIVOLUME .; verification. .; Version 5 allows easy backup of logical devices by allowing you .; to specify them by file name. Date of last backup is reported, .; and multiple backups can be done at one INCBUP session. .; Version 6 changed to allow file or device names to be entered. .; Also doesn't ask the same questions on multiple backups in one .; session. .; .sets IBVER "6.2" .; Version of 6-May-87. .; .; Written by: R. W. Barnard .; BIO/Comp Applications .; P. O. Box 5342 .; Albuquerque, NM 87185 .; .enable global .enable quiet .; .; ****** Start of User-Changeable Setup Parameters ****** .; Change the default BACKUP VOLUME here. .sets BKV "LD4:" .; Change the default BACKUP DEVICE here (used if BKV is an LD unit). .sets BKD "DL0:" .; .sets BKD "DU1:" .; Change the default device for logical disk files being backed up here. .sets $DEFDV "DU3:" .;Needs the final ":"!!! .; .sets $DEFDV "DU0:" .; Change the volume initialization owner name here. .sets OWNAME "R W Barnard" .; .; Set up the printer here. .sets EPOFF "1" .;Turn off 's between .sets EPON "1" .;directories. .sets FFEND "1" .;Do a final . .; Change the default SOURCE VOLUME here. .sets SRV "SY:" .; Change the assignment of your work device here. .;ASSIGN VM WF .; .; Change the name of the file to remember DSKLIB catalog numbers here. .sets DLBFIL "SY:INCBUP.DAT" .; Change the default extension for logical disk files here. .sets $DEFXT "DSK" .; ****** End of User-Changeable Setup Parameters ****** .; .disable lowercase,octal .disable prefix, suffix .enable escape SET TT QUIET .; .; Clear the screen. ; ; ; INCBUP - RT-11 Incremental file backup, Version 'IBVER' .; .; Exiting instructions to the user. ; ; You may stop the command file by typing ; in answer to any question. ; .ifdf EPOFF SET SP0 ENDPAG=0 .; .start: .asks [0:14.:"'SRV'"] SOURCE Enter the volume to be backed up ['SRV']: .ift .goto quit @SY:PARSE 'SOURCE' .if $DEV eq "NSD" .goto start .;Bad device. .if $FILNM eq "" .goto disk .;Must have given a real device. .; .testfile '$FILSP' .if eq .goto 10 .;The file exists. ; ;The file '$FILSP' was not found. .goto start .; .10: RU WF:READLD .openr WF:LDLGCL.TMP .ldloop: .read LINE .parse LINE " " LDINUS A1 A2 .if A1 eq $FILSP .goto 30 .if LDINUS eq "" .or .if LDINUS eq "No" .goto 20 .goto ldloop .; .20: .setn L1 0 .;Find the first unused LD unit number. .ldlp: .testdevice LD'L1' .parse "," A2 A1 A1 A1 A1 A1 A1 A3 A1 .inc L1 .if L1 eq 8 .goto nolds .if A3 eq "MTD" .goto ldlp .erase local LDINUS .;No LD unit in use. .goto 40 .; .30: .sets A2 LDINUS .;Use the LD unit number already assigned. .40: .close .asks [0:4:"'A2'"] CURLD What LD unit do you want to use for backing up '$FILNM' ['A2']? .ift .goto quit .if ge 3 .sets CURLD "LD"+CURLD[3:3]+":" .if eq 1 .sets CURLD "LD"+CURLD+":" .; .sets LDLOG $FILNM[1:3] .;Try to use 1st 3 chars as logical name ; The backup set identifier will be "'LDLOG'" .ask [] QQ Is this OK [Y] .ift .goto quit .iff QQ .asks [1:3] LDLOG Then enter the identifier: .ift .goto quit .; MOUNT 'CURLD' '$FILSP' 'LDLOG' .sets SRCVOL LDLOG ASSIGN 'CURLD' INP .goto 50 .; .disk: .parse SOURCE ":" SOURCE A2 .sets SRCVOL SOURCE .sets LDINUS "1" .;Need to define it anyway. ASSIGN 'SOURCE' INP .50: .sets BVOL SRCVOL .;Save the exact name. .test SRCVOL .if eq 3 .goto 60 .;Must make sure it is exactly .sets BLANKS " " .;3 characters. .sets SRCVOL SRCVOL+BLANKS['':2] .; .60: .ifdf REPEAT .goto r10 .ifdf LASBAK .goto 70 .testfile 'DLBFIL' .if ne .gosub dsknum .openr 'DLBFIL' .read LASBAK .read LASBAK .;Get the date of the last backup. .close .70: ; ; The last backup was done on 'LASBAK' .ifdf STRTDT .goto 80 .;We already have a start date. .parse LASBAK "-- " DAY MON YR A1 .;The following is an attempt at automatically picking the date for LASDAT. .setn L1 'DAY'+1. .sets STRTDT "'L1'-'MON'-'YR'" .80: .asks [0:9.:"'STRTDT'"] LASDAT Enter the starting date for this backup ['STRTDT']: .ift .goto quit .test LASDAT "-" .;Find out if - was typed in date .if eq 0 .goto 90 .;instead of :. .parse LASDAT "-" A1 A2 A3 .if A2 ne "" .sets LASDAT A1+":"+A2 .if A3 ne "" .sets LASDAT LASDAT+":"+A3 .90: .sets STRTDT LASDAT .;Use the date just entered next time. .; .parse "-" DAY MON YR .r10: .gosub trnmon DIR/BRI/OUT:WF:INCBUP/SINCE:'LASDAT'/EXCLUDE INP:*.(BAK,DSK,TMP) .openr WF:INCBUP.DIR .read LINE .;Read the date line. .loop: .read LINE .;Read the remainder of the directory. .parse LINE "," FILES BLOCKS .if BLOCKS eq "" .goto 100 .parse FILES " " A1 NUMFIL A2 .parse BLOCKS " " A1 BLKSIZ A2 .goto 110 .; .100: .iff .goto loop .110: .close .if BLKSIZ eq "0" .goto nuttin .; ; ; You have 'BLKSIZ' blocks, 'NUMFIL' files to be backed up. ; .setn SEGSIZ 'NUMFIL'/70+1 .ifdf REPEAT .goto r20 .asks [0:4:"'BKV'"] BKVOL Enter the backup target volume ['BKV']: .ift .goto quit .; Get rid of any : that may have been typed. .parse BKVOL ":" BKVOL A2 .; ASSIGN 'BKVOL' OUP .; Create the file to initialize the output volume. .r20: .openr #2 'DLBFIL' .read #2 DSKNUM .close #2 .enable lowercase .open WF:INITD.COM .enable data R DUP OUP:/Z/V/Y/N:'SEGSIZ' 'DSKNUM'Bak'SRCVOL''MO''DAY' 'OWNAME' ^C .disable data .close .disable lowercase .sets MULCOP "" .; .sets DEVNAM BKVOL[1:2] .;Get the 1st 2 chars of device name. .if DEVNAM ne "LD" .goto 150 .; .; ***Backup to Logical Devices*** .; .ifdf REPEAT .goto r30 .asks [0:4:"'BKD'"] BKPDEV Enter the backup device for the logical disk ['BKD']: .ift .goto quit .parse BKPDEV ":" BKPDEV A3 .sets BKD BKPDEV .;Might as well change the default to current. .r30: .setn BKPSIZ 'BLKSIZ'.+6+(2*'SEGSIZ') .; .dsksiz: .gosub dskchk .if MAXSIZ ge BKPSIZ .goto 120 ; .ask QQ Your files won''t fit on this disk. Put in another and type .ift .goto quit .goto dsksiz .; .120: .sets BKUFIL "'BKPDEV':BAK'BVOL'.'MO''DAY'" .testfile 'BKUFIL' .if ne .goto 140 ; .ask [] QQ File 'BKUFIL' exists... Delete it [N]? .iff QQ .goto 130 UNPROT 'BKUFIL' DELETE/NOQUERY 'BKUFIL' .goto 140 .; .130: .ask QQ Put in another disk and type .ift .goto quit .goto dsksiz .; .140: CREATE 'BKUFIL'/ALL:'BKPSIZ' MOUNT 'BKVOL' 'BKUFIL' .; .; Make the file to run the DSKLIB cataloger. .open WF:DSKLIB.COM .data R DLBCOM .data OSY:INCBUP UF'BKUFIL' Q .close ; ; Initializing the backup volume ('BKVOL') now. $@WF:INITD.COM .goto 180 .; .; ***Backup to a Physical device*** .; .150: .sets BKPDEV BKVOL ; .ask [] QQ Do you want to initialize the backup device [Y]? .ift .goto quit .iff QQ .goto 160 $@WF:INITD.COM .160: .gosub dskchk .setn BLKN 'BLKSIZ' .if MAXSIZ ge BLKN .goto 170 .sets MULCOP "/MULTIVOL" ; Need to do a multivolume backup. .; .; Make the file to run the DSKLIB cataloguer. .170: .open WF:DSKLIB.COM .data R DLBCOM .data OSY:INCBUP UF'BKVOL': Q .close .; .180: DELETE/NOQ WF:(INCBUP.DIR,INITD.COM) ; ; Copying the files to the backup volume now. COPY/SINCE:'LASDAT'/INFORM/EXCLUDE/NOLOG'MULCOP'/SYS INP:*.(BAK,DSK,TMP) OUP: .setf SLON .ifloa SL .sett SLON SET SL OFF .; .; Do different things depending on MULCOP. .if MULCOP ne "" .goto 190 ; ; Verifying the files on the backup volume now. COPY/SYSTEM/NOLOG OUP:*.* NL: ; ; Cataloging the backed-up files now. $@WF:DSKLIB DIRECTORY/PRINTER/VOLUME OUP: .if DEVNAM eq "LD" DISMOUNT 'BKVOL' .ifdf LDINUS .goto 210 DISMOUNT 'CURLD' .goto 210 .; .190: ; ; Verifying the backup output volumes now. ; Start with the first disk in the sequence. ; Type with no disk in 'BKVOL' when all have been verified. .setn L1 1 .vfylp: ; .ask QQ Put disk 'L1' in drive 'BKVOL' and type .testdevice OUP .parse "," A2 A2 A2 A2 A2 A2 ONLINE A2 .if ONLINE ne "ONL" .goto 210 COPY/SYSTEM/NOLOG OUP:*.* NL: .if L1 eq 1 .goto 200 .; .setn DN 'DSKNUM' .;Need to give vol ID to second and later .inc DN .;disks. .sets DSKN "'DN'" .gosub longnm .open WF:DSKLIB.COM .enable data R DLBCOM OSY:INCBUPVF'BKVOL':'DSKNUM'Bk'DSKN''SRCVOL'.'MO''DAY'/OWUF'BKVOL':Q .disable data .close .200: ; ; Cataloging the backed-up files now. $@WF:DSKLIB DIRECTORY/PRINTER/VOLUME OUP: .inc L1 .goto vfylp .; .210: .ift SLON SET SL ON .; Increment the number for DSLKIB. .setn DN 'DSKNUM' .inc DN .sets DSKN "'DN'" .gosub longnm .; Write the latest DSKLIB disk number in a file for use next time. .open #2 'DLBFIL' .data #2 'DSKNUM' .data #2 '' at '