Operating System - OpenVMS
1753401 Members
7117 Online
108792 Solutions
New Discussion юеВ

Re: OpenVMS and Backup Script

 
SOLVED
Go to solution
Ryan Frillman
Occasional Contributor

OpenVMS and Backup Script

I want to be able to write a script that would sit in a queue and automatically run daily, weekly, and monthly backups. I don't know how to determine which day is the end of the week and which day is the beginning of the month. Does anyone have a script that I could follow?
13 REPLIES 13
Uwe Zessin
Honored Contributor

Re: OpenVMS and Backup Script

No scripts, but a short example:

$ w = F$CVTIME (F$TIME(),,"WEEKDAY")
$ show symbol w
W = "Tuesday"
$


A month does always begin with day 1, no?

$ d = F$CVTIME (F$TIME(),,"DAY")
$ show symbol d
D = "21"
$
.
Steven Schweda
Honored Contributor

Re: OpenVMS and Backup Script

You could have it run every day, and check
for day of month = 1, and day of week = X,
where X is your "end of the week" day. For
example:

$ write sys$output F$CVTIME( "", , "DAY")
21

$ write sys$output F$CVTIME( "", , "WEEKDAY")
Tuesday

See "HELP LEXICALS F$CVTIME".

Running every day can be done by having the
procedure re-SUBMIT itself with an
appropriate /AFTER option. For example, to
run again tomorrow at 00:10:00, add code
like this to the end of the procedure:

$!
$! Re-submit the latest version of this procedure.
$!
$ CPR = F$ENVIRONMENT( "PROCEDURE")
$ CPR = CPR- F$PARSE( CPR, , , "VERSION")
$!
$ IF (CPR .NES. "")
$ THEN
$ SUBMIT -
/AFTER = "TOMORROW+ 00:10:00" -
/NOPRINTER -
'CPR'
$ ENDIF

(Of course, the real thing has better
indentation than you can see here.)

I have a SYS$MANAGER:DAILY.COM which does a
few things, like:

Submit the daily incremental BACKUP job.
Run a procedure to check for nearly full disks.
Purge some useless log files.
Et c.
Phillip Thayer
Esteemed Contributor

Re: OpenVMS and Backup Script

Another quick way to get the current day is:

f$element(2,"-",f$element(0," ",f$cvtime()))

I use this all the time and it works great.

Phil
Once it's in production it's all bugs after that.
Ryan Frillman
Occasional Contributor

Re: OpenVMS and Backup Script

Is there any way I could see that SYS$MANAGER:DAILY.COM script just the daily backup part not all the rest.
Phillip Thayer
Esteemed Contributor

Re: OpenVMS and Backup Script

There is no way to do this from the BACKUP command only. You will have to have a "driver" DCL script that determines what day it is and then executes (with @SYS$MANAGER:DAILY) the daily script during the weekdays, executes (with @SYS$MANAGER:WEEKLY) the weekly script when it is a weekend, using the F$CVTIME (F$TIME(),,"WEEKDAY", to determine if it is the day you want to run the weekly backups and then a check for the day of the month to determine it it is the first of the month (or whatever day of the month) for the monthly backups and executes the (with @SYS$MANAGER:MONTHLY) the monthly backups.

I would say check for the Monthly backup first, then weekly and then daily.

Phil
Once it's in production it's all bugs after that.
Steven Schweda
Honored Contributor

Re: OpenVMS and Backup Script

> Is there any way I could see [...]

Well, the BACKUP part is just this (again,
with better indentation):

$!
$! Nightly incremental BACKUP.
$!
$ CPR := HOME_BACKUP:[BACKUP]INCR.COM
$ CPRF = F$SEARCH( CPR)
$ IF (CPRF .NES. "")
$ THEN
$!
$ LOG = CPRF- -
F$PARSE( CPRF, , , "VERSION")- F$PARSE( CPRF, , , "TYPE")+ ".LOG"
$!
$ SUBMIT -
/AFTER = 01:10 -
/LOG = 'LOG' -
/NOPRINTER -
/USER = BACKUP -
'CPR'
$!
$ PURGE /KEEP = 31 'LOG'
$!
$ ENDIF
$!

So, my daily incremental BACKUP jobs start
at about 1:10 every day. If you'd like any
additional stuff, send some e-mail to
sms@antinode-org (roughly).
Klaes-G├╢ran Carlsson
Frequent Advisor
Solution

Re: OpenVMS and Backup Script

Hi

Attached a part of my backup routine, maybee you can pick out some dcl-code from it.

/Klaes-Goran
Jan van den Ende
Honored Contributor

Re: OpenVMS and Backup Script

Steven wrote:

"
For example, to
run again tomorrow at 00:10:00, add code
like this to the end of the procedure:

"

I do MUCH prefer to put the re-submitting code at the BEGINNING of any repeating batch jobs!

This guarantees, that regardless of ANY things happening during the run, the next run will be in the queue.

hth

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Steven Schweda
Honored Contributor

Re: OpenVMS and Backup Script

> I do MUCH prefer to put the re-submitting
> code at the BEGINNING of any repeating
> batch jobs!

The BEGINNING of my DAILY.COM looks like THIS:

$!
$! Daily tasks. Run once per day.
$!
$ SET NOON
$!

> This guarantees, that regardless of ANY
> things happening during the run, the next
> run will be in the queue.

It's a rare problem which has but one
solution.

When I first started using VMS, I was often
puzzled by the significance of 12:00 PM, but
eventually I figured it out.