Last active
August 29, 2015 14:04
-
-
Save enriquemanuel/d006aa57ebadbff06e34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#custom vars | |
vDATE=`date +"%Y-%m-%d"` | |
# EXPORT BLACKBOARD BASIC CONFIGURATION | |
export BBHOME=`grep bbconfig.basedir= /usr/local/blackboard/config/bb-config.properties |cut -d= -f2`; | |
export BBCONF=$BBHOME/config/bb-config.properties; | |
export VINAME=`grep antargs.default.vi.db.name= $BBCONF|cut -d= -f2`; | |
# EXPORT PATH AND ORACLE HOME | |
export ORACLE_HOME=/usr/local/blackboard/apps/oracle-client; | |
export PATH=$ORACLE_HOME/bin64:$ORACLE_HOME/bin32:$PATH; | |
export LD_LIBRARY_PATH=$ORACLE_HOME/lib64:$ORACLE_HOME/lib32:$LD_LIBRARY_PATH; | |
## EXPORT DATABASE VARIABLES, BASED ON BBCONFIG FILE | |
export DBHOST=`grep bbconfig.database.server.fullhostname $BBCONF|cut -d= -f2`; | |
export DBPORT=`grep bbconfig.database.server.portnumber $BBCONF|cut -d= -f2`; | |
export ORASID=`grep bbconfig.database.server.instancename= $BBCONF|cut -d= -f2`; | |
export MAINPASSCURR=`grep antargs.default.vi.db.password $BBCONF|cut -d= -f2`; | |
echo "set feedback off pagesize 50000 linesize 200 long 99999 | |
col course_id FORMAT a140 | |
spool /var/tmp/temp_file.txt | |
select * from course_main; | |
spool off | |
exit" | sqlplus -s "$VINAME/$MAINPASSCURR@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$DBHOST)(PORT=$DBPORT))(CONNECT_DATA=(SID=$ORASID)))" | |
# here we can do anything we want | |
# execute another script | |
# rm files or make anything from the file that we just created | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment