$! $! EVERYWEEK.JOB $! $! This batch job is run once every week at midnight on Sunday. $! Its purpose is to submit other batch jobs to be run on a weekly $! basis. $! $ verify_mode = 'F$VERIFY(0)' $ GOTO L1$ $!+ EVERYWEEK $! Items to be handled on a weekly basis are done by the EVRYWEEK 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 $! $! or by: $! $! SUBMIT/NOPRINT/NAME=EVRYWEEK/PARAMETER=opcode - $! SYS$MGR_UTIL:EVERYWEEK.JOB $! $!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 EVRYWEEK batch job (also deletes any such $! jobs currently in the batch queue). Does not execute $! EVERYWEEK.COM. $! $! 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. $!- $! $! Created: 4-Sep-81 Frank J. Nagy Fermilab Accelerator/Controls $! $! Modifications: $! 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 $!============================================================================= $L1$: $! $ SET NOON $! $! Test for SETUP run (called as a command procedure) $! or for a ONCEONLY run (no re-submission) $! or for a normal (GOGOGO) midnight run $! - all by looking at parameter P1 $! $ IF P1 .EQS. "ONCEONLY" THEN GOTO DO_MY_THING $ IF P1 .NES. "GOGOGO" THEN GOTO FIRST_TIME_THRU $! $ PURGE EVRYWEEK.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/AFTER="TODAY+7-00:00"/NAME=EVRYWEEK/PARAMETERS=GOGOGO/PRIORITY=28- /NOPRINT SYS$MGR_UTIL:EVERYWEEK.JOB $ SHOW QUEUE/ALL SYS$BATCH $! $DO_MY_THING: $! $ GOTO L10$ $! Here is where the real work gets done. The SUBMIT commands (or @name) $! commands should go in the SYS$MGR_UTIL:EVERYWEEK.COM file. Remember $! that this job is running under the SYSTEM account (UIC [1,4]) as will any $! batch jobs SUBMIT'ed from here or any command files executed from here. $! The current default directory is now: SYS$MANAGER:!!! $! If a batch job must be run under a different user either you can: $! 1. Change the UIC and default directory at the start of the $! command file submitted as a batch job. $! 2. SPAWN a command file off under a different UIC to do you thing $! or SUBMIT a batch job. (Or you can insert a detached process $! RUN command into here). $! Note that the .LOG files for batch jobs submitted from here or detached $! processes SPAWN'ed from here are placed in SYS$MANAGER:. $! $! 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 EVRYWEEK 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. $! $L10$: $! $ IF verify_mode THEN SET VERIFY $! ===================== $@SYS$MGR_UTIL:EVERYWEEK.COM $! ===================== $! $ EXIT ! End-of-job for this week $! $! For first time do: @EVERYWEEK.JOB SETUP $! $FIRST_TIME_THRU: $! $! Delete any current EVRYWEEK jobs in the queue $! $@SYS$MGR_UTIL:BATQUEDEL EVRYWEEK $ IF job_time .EQS. "" THEN GOTO NONE_IN_QUEUE $! $! Deleted one pending, resubmit with the absolute time from $! the deleted job. $! $ SUBMIT/AFTER='job_time'/NAME=EVRYWEEK/PARAMETERS=GOGOGO/PRIORITY=28/NOPRINT - SYS$MGR_UTIL:EVERYWEEK.JOB $ SHOW QUEUE/ALL SYS$BATCH $! $ EXIT $! $NONE_IN_QUEUE: $! $! Get current day of week $! $@FERMI$EXE:DAYOFWEEK $! $! Get number of days to delay until midnight Sunday (i.e. 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/AFTER='abs_date'/NAME=EVRYWEEK/PARAMETERS=GOGOGO/PRIORITY=28/NOPRINT - SYS$MGR_UTIL:EVERYWEEK.JOB $ SHOW QUEUE/ALL SYS$BATCH $ EXIT