Has anyone been able to get this process to run in Cron (using a shell script)? I have been able to run about 13-14 Banner processes (still a few problems, but overall it works) to run using a shell script with Cron, but this one process does not work right.
Any help would be appreciated,
Grim
You can run any job in
You can run any job in jobsub via cron, but there is a trick and a couple things to keep in mind.
One is that not all jobs will have parameters that can be entered via command line (through prompts). SGHE is not necessarily going to continue maintaining the manual prompts.
Second is that you probably want to run a job with a new one up ID each time. I used to use a static ID for certain jobs, but that got me in trouble one day, with TSRCBIL. So I stopped.
Here are some ideas:
Insert your job parameters into the database first. Get a one up number along the way; echo it out so another program can grab it. Here's something for GLBDATA.
params_glbdata.sql
--------------------------------------------
SET SERVEROUTPUT ON
SET FEEDBACK OFF
DECLARE
JOBNUM NUMBER;
BEGIN
SELECT GENERAL.GJBPSEQ.NEXTVAL INTO JOBNUM FROM DUAL;
DBMS_OUTPUT.ENABLE(100000);
DBMS_OUTPUT.PUT_LINE(JOBNUM);
INSERT INTO GJBPRUN VALUES ('GLBDATA',JOBNUM,'01',SYSDATE,'MY_POPSEL','');
INSERT INTO GJBPRUN VALUES ('GLBDATA',JOBNUM,'02',SYSDATE,'','');
INSERT INTO GJBPRUN VALUES ('GLBDATA',JOBNUM,'03',SYSDATE,'','');
INSERT INTO GJBPRUN VALUES ('GLBDATA',JOBNUM,'04',SYSDATE,'','');
INSERT INTO GJBPRUN VALUES ('GLBDATA',JOBNUM,'05',SYSDATE,'','');
INSERT INTO GJBPRUN VALUES ('GLBDATA',JOBNUM,'06',SYSDATE,'STUDENT','');
INSERT INTO GJBPRUN VALUES ('GLBDATA',JOBNUM,'07',SYSDATE,'AWEEKS','');
INSERT INTO GJBPRUN VALUES ('GLBDATA',JOBNUM,'08',SYSDATE,'','');
INSERT INTO GJBPRUN VALUES ('GLBDATA',JOBNUM,'88',SYSDATE,TO_CHAR(SYSDATE - 2, 'DD-MON-YYYY'),'Yesterday');
INSERT INTO GJBPRUN VALUES ('GLBDATA',JOBNUM,'88',SYSDATE,TO_CHAR(SYSDATE, 'DD-MON-YYYY'),'Today');
COMMIT;
END;
--------------------------------------------
You'll note that there are two dynamic parameters, numbered 88. The last field in GJBPRUN tells it to which label the value is being associated. Not all popsels will have a dynamic parameter, of course.
Wrap it around a shell script and execute it using gjajobs.shl:
run_glbdata.shl
--------------------------------------------
#!/bin/bash
# Load in params; grab the job num from STDOUT
JOBNUM=`sqlplus -s $CRONUSER/$CRONPASSWD @params_glbdata`
# Run the job
gjajobs.shl GLBDATA P $CRONUSER $CRONPASSWD $JOBNUM NOPRINT
That would be the very basics of it. JOBNUM in the shell script will receive the output from the dbms_output statement in the sql script. The -s statement will just cause sqlplus to not print out the other crap that it usually spits out, which would interfere with the retrieval of the job number. There are other ways to do that, I guess, like writing a file somewhere with the job num inside.
Running the job through gjajobs.shl like that will cause it to run in the background. If you want things to run more interactively, I would suggest modifying gjajobs.shl to wrap the line
sh $H/$TEMP.shl &
With something like
if [ "$USER" = "gjajobs" ]; then
sh $H/$TEMP.shl &
else
sh $H/$TEMP.shl
fi
This would cause jobs run through Banner job submission to run in the background; jobs run from any other user would run in the foreground.
If you follow this procedure, you can run pretty much any job in banner without having to come up with a different procedure for every job (since C programs will run differently than COBOL programs, reports run a bit differently, etc).