From: hoffman@xdelta.zko.dec.nospam Sent: Friday, July 09, 1999 10:32 AM To: Info-VAX@Mvb.Saic.Com Subject: Re: ? on DCL command files In article <378564f7.155576672@news.adnc.com>, cynthia727@yahoo.com (Cynthia Lee) writes: :Does anyone know of a web page where some sample DCL command :procedures can be downloaded? In particular, anything dealing with :print queues and backups is of primary interest. The FAQ points to a variety of sites with examples... There are books on the subject of writing in DCL, too. :-) What sorts of specific question(s) do you have? Questions of system BACKUPs and queue manipulation can range from the trivial to the complex. I have attached a trivial BACKUP procedure below -- this was a quick hack written many years ago. The procedure is suitable for systems with more tape capacity than disk capacity... Some local customization will be required... -------------------------- pure personal opinion --------------------------- Hoff (Stephen) Hoffman OpenVMS Engineering hoffman#xdelta.zko.dec.com -- $! BCK.COM $! $! A procedure that submits itself as a batch job, and is used for $! backing up a workstation to a (sufficiently large) tape drive... $! This procedure resets /NOBACKUP status on several directories, $! and it issues PURGEs. $! $! This batch job runs a full backup (with /RECORD) on Friday night, $! and incrementals the other nights. $! $! To submit the batch job, simply invoke this procedure with no $! options specified. A batch job will be submitted to SYS$BATCH:. $! $! Steve Hoffman $! Digital Equipment Corporation $! $! P1 is a comma-seperated list of options $! F: do FULL tonight (override default) $! N: do it NOW, and not /AFTER=TOMORROW+18:00 $ $ Set NoOn $ $ mynameis = f$environment("PROCEDURE") $ goto 'f$mode()' $ $INTERACTIVE: $NETWORK: $OTHER: $ $! see if we should do this now, else wait... $ $ NOW = "FALSE" $ if f$locate(",N,",",''p1',") .ne. f$length(",''p1',") then NOW = "TRUE" $ $ If (NOW) $ Then $ After = "" $ Else $ After = "/AFTER=""TOMORROW+18:00"" " $ EndIf $ $ SUBMIT 'mynameis' 'After' - /NOPRINT/KEEP/PARAM=("''p1'") - /LOG_File=SRH:[BCK]BCK.LOG/NAME=BACKUP $ $ Exit $ $BATCH: $ $ Set Process/Prio=2 $ $ SET VERIFY $ $ SUBMIT 'mynameis' - /AFTER="TOMORROW+18:00"/NOPRINT/KEEP - /LOG_File=SRH:[BCK]BCK.LOG/NAME=BACKUP $ PURGE SYS$LOGIN:BCK.LOG/KEEP=14 $ $ purg SYS$SYSROOT:[SYSCOMMON.AMDS]*.log/log $ set file SYS$SYSROOT:[SYSCOMMON.AMDS]*.log;*/noback $ set file SYS$SYSROOT:[SYSCOMMON.DECW$BOOK]*.*;*/noback $ set file SRH:[SCRATCH...]*.*;*/noback $ $ day = F$Edit(f$cvtim(,,"WEEKDAY"),"COLLAPSE,UPCASE") $ $! see if a full backup should be performed, default not... $ $ DOFULL = "FALSE" $ if "''day'" .eqs. "FRIDAY" then DOFULL = "TRUE" $ if f$locate(",F,",",''p1',") .ne. f$length(",''p1',") then DOFULL = "TRUE" $ $ if (DOFULL) $ Then $ Call FULL $ Else $ Call INCR $ EndIf $ $ if "''day'" .eqs. "THURSDAY" $ Then $ DISMOUNT/UNLOAD MKA500: $ Reply/All/Bell "Unloading tape -- please load tape for Friday" $ Else $ DISMOUNT/NOUNLOAD MKA500: $ EndIf $ $ $ Exit $ $INCR: SUBROUTINE $ Set NoOn $ Reply/All/Bell "Starting Incremental Backup" $ Write sys$output "Starting Incremental Backup" $ Mount/For/NoAssist MKA500: $ saveset = f$cvtime(,"COMPARISON","DATE") + ".BCK" - "-" - "-" $ comment = "Incremental " + f$cvtime(,,"DATE") $ Backup - Sys$SysDevice:[*...]*.*;*/SINCE=BACKUP - MKA500:'saveset'/Save/NoRewi - /Comment="''comment'" - /Label=BCK/Igno=(Label)/Verif $ if $severity .and. 1 $ then $ write sys$output "Incremental BACKUP completed" $ Reply/All/Bell "Incremental BACKUP completed" $ else $ write sys$output "Incremental Backup completed with error(s)" $ Reply/All/Bell "Incremental Backup completed with error(s)" $ endif $ Return $ EndSubroutine $ $FULL: SUBROUTINE $ Set NoOn $ Reply/All/Bell "Starting Full Backup" $ Write sys$output "Starting Full Backup" $ Mount/For/NoAssist MKA500: $ saveset = f$cvtime(,"COMPARISON","DATE") + ".BCK" - "-" - "-" $ comment = "Full " + f$cvtime(,,"DATE") $ Backup - Sys$SysDevice:/Image - MKA500:'saveset'/Save/Rewi - /Comment="''comment'" - /Label=BCK/Igno=(Label)/Verif/Record $ if $severity .and. 1 $ then $ write sys$output "Full BACKUP completed" $ Reply/All/Bell "Full BACKUP completed" $ else $ write sys$output "Full Backup completed with error(s)" $ Reply/All/Bell "Full Backup completed with error(s)" $ endif $ Return $ EndSubroutine