$!.. EVERYWEEK.JOB Weekly batch job control procedure $ every_queue = "SHORT_JOBS" !Queue for system's EVERY* jobs $ SET NOON $ SUBMIT_JOB := SUBMIT /QUEUE='every_queue' /PRIORITY=28 /NOPRINT - /LOG_FILE=CMN$MANAGER: /USER=SYSMANAGER /NAME=EVERYWEEK $ IF P1 .EQS. "ONCEONLY" THEN GOTO DO_MY_THING !Once-only $ IF P1 .NES. "GOGOGO" THEN GOTO FIRST_TIME_THRU !1st time setup $ PURGE EVERYWEEK.LOG !Purge old versions of log file $! Re-submit to run at midnight 7 days from now - a week hence $! (i.e. 00:00:00 hours next Sunday). $ SUBMIT_JOB /AFTER="TODAY+7-00:00" - SYS$MGR_UTIL:EVERYWEEK.JOB /PARAMETERS=GOGOGO $DO_MY_THING: $@SYS$MGR_UTIL:EVERYWEEK.COM !Here is where the real work is done $ EXIT ! End-of-job for this week $FIRST_TIME_THRU: !First time: @EVERYWEEK.JOB [IFF_]SETUP $ IF p1 .EQS. "SETUP" THEN $ GOTO UNCONDITIONAL_RESTART $ ON WARNING THEN $ GOTO NONE_IN_QUEUE !If no jobs found in queue scan... $@FERMI$UTIL:BATJOBTST EVERYWEEK 'every_queue' SYSMANAGER $ EXIT !Job already queued, just exit! $UNCONDITIONAL_RESTART: !First time: @EVERYWEEK.JOB SETUP $@FERMI$UTIL:BATQUEDEL EVERYWEEK 'every_queue' SYSMANAGER $ IF job_time .EQS. "" THEN $ GOTO NONE_IN_QUEUE $! Deleted one pending, resubmit with the absolute time from deleted job. $ SUBMIT_JOB /AFTER='job_time' - SYS$MGR_UTIL:EVERYWEEK.JOB /PARAMETERS=GOGOGO $ EXIT $NONE_IN_QUEUE: $@FERMI$EXE:DAYOFWEEK !Get current day of week $! Get number of days to delay until midnight Sunday (00:00:00 Monday) $ day_delay = 8 - day_of_week_ndx $ IF day_delay .EQ. 8 THEN day_delay = 1 $! Setup absolute date plus delta for correct number of days (until next $! Sunday) from midnight (00:00 AM) today. $ abs_date = """TODAY+" + F$STRING(day_delay) + "-00:00""" $ SUBMIT_JOB /AFTER='abs_date' - SYS$MGR_UTIL:EVERYWEEK.JOB /PARAMETERS=GOGOGO $ EXIT $!============================================================================== $! EVERYWEEK.JOB $!+ EVERYWEEK $! Items to be handled on a weekly basis are done by the EVERYWEEK job. $! This batch job uses the command procedure EVERYWEEK.JOB to perform the $! housekeeping chores of setting and re-submitting the weekly job. The $! actual work is done in the EVERYWEEK.COM command procedure (to allow $! changes without having to resubmit the batch job). The batch job is $! invoked by: $! $! @SYS$MGR_UTIL:EVERYWEEK.JOB opcode $! $!2 Opcode $! The operation code passed as the first parameter to the EVERYWEEK.JOB $! command procedure determines the action this command procedure takes: $! $! SETUP setup the EVERYWEEK batch job (also deletes any such $! jobs currently in the batch queue). Does not execute $! EVERYWEEK.COM. Does an unconditional restart $! $! IFF_SETUP same as SETUP if, and only if, there is not an EVERYWEEK $! job already in the queue (conditional restart). $! $! ONCEONLY run once (with no re-submittal) usually for a test. $! $! GOGOGO normal operation, re-submit to run next month and then $! execute EVERYWEEK.COM. $!- $! $! Changes to command files referenced in here may be made freely. If this $! command file is changed, you must be the SYSTEM user and the very next $! thing you must do is to do a setup run as in "@EVERYWEEK.JOB SETUP" to $! delete any current EVERYWEEK batch job(s) are re-submit so that the new $! version of the command file will be used. This job will also be re-submitted $! after the VAX is rebooted. $! $!============================================================================= $! Author: Frank J. Nagy Fermilab Accelerator/Controls $! Modifications: $! 04-Sep-81 FJN Created $! 18-Sep-81 FJN Submit EVRYWEEK job at priority 5 $! 26-Sep-81 FJN Modify DSKUSAGE job for dual user packs $! 18-Mar-82 FJN Split action off into EVERYWEEK.COM to allow for easier $! changing $! 19-Aug-82 FJN Moved command procedures to FERMI$EXE, prepared for $! usage with VMS V3 $! 30-Aug-82 FJN Use VMS V3 features. $! 03-Sep-82 FJN Fix /AFTER when doing SETUP and no previous job. $! 06-Oct-82 FJN Raised batch priority $! 29-Nov-83 FJN Moved BATQUEDEL to FERMI$UTIL $! 29-Aug-84 LAV Removed show queue commands (after submit batch job) $! 05-Sep-84 FJN Finally changed job name to EVERYWEEK! $! 26-Oct-84 FJN Run EVERYWEEK job from SHORT_JOBS queue $! 07-Jun-85 FJN Use VMS V4 features and compress/move comments $! 09-Jun-85 FJN Add IFF_SETUP to restart job if-and-only-if there is $! no EVERYWEEK job already queued $! 18-Oct-85 FJN Put EVERYWEEK.LOG file into CMN$MANAGER: