cancel
Showing results for 
Search instead for 
Did you mean: 

How to script BRTools tasks to run in crontab with variables in Red Hat

mattsava
Participant
0 Kudos

I am currently trying to schedule BRTools tasks in crontab in Red Hat, (yes we should be using DB13, I'd rather not get in to the details of that). I am trying to automate the tasks so they are at least running for the moment. I can run all the tasks at the command line under the user <SID>adm and they run fine but when I schedule a script containing the line it complains about variables not being set. I have tried running a variable file before running BRTools command and it seems to have all variables required but complains the database instance is shutdown when it is not. Can someone advise how to run brtools commands from crontab with the variables required. My current script, very short as follows:

. /home/<SID>adm/.dbenv_<server>.sh

/sapmnt/<SID>/exe/uc/linuxx86_64/brconnect -u // -c -f check

The output I am getting is: BR0801I BRCONNECT 7.40 (47) BR0805I Start of BRCONNECT processing: cfjecwdl.chk 2022-05-24 11:48:01 BR0484I BRCONNECT log file: /oracle/<SID>/sapcheck/cfjecwdl.chk
BR0613E Database instance <SID>is shut down BR1614I Oracle client environment: HOST=<SERVERNAME>, USER=<SID>adm/<SID>adm, GROUP=sapsys/sapsys, ORACLE_SID=<SID>, ORACLE_HOME=/oracle/P RD/19, ORACLE_BASE=/oracle/<SID>
BR0806I End of BRCONNECT processing: cfjecwdl.chk 2022-05-24 11:48:01 BR0280I BRCONNECT time stamp: 2022-05-24 11:48:01 BR0804I BRCONNECT terminated with errors**Note server name and SID above have been changed**

Accepted Solutions (1)

Accepted Solutions (1)

chico_zhu
Employee
Employee
0 Kudos

The error isn't quite clear what's wrong. You can try to follow kba 3194331 Missing runtime environment variables when directly schedule SAP executables from Linux OS crontab to:

-schedule the job in sidadm crontab.

-export environment variables from crontab too.

See if it works or with different error. As you also noticed, DB13 is strongly recommended for DBA activities anyway.

Answers (0)