Skip to content

Instantly share code, notes, and snippets.

@petrohs
Created August 20, 2020 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petrohs/93e37b3ebaf8e6909c1f2e41fe567788 to your computer and use it in GitHub Desktop.
Save petrohs/93e37b3ebaf8e6909c1f2e41fe567788 to your computer and use it in GitHub Desktop.
descargaConfiguracion¦ Descarga variables de configuraciones desde base de datos
#!/bin/sh
##/usr/bin/sh
ayuda () { echo '
#===============================================================================
# SCRIPT: descargaConfiguracion
#
# USO: descargaConfiguracion.sh [-t pref] [-o sal] [-b bloq] osid
# DESCRIPCION: descarga variables de configuraciones desde base de datos
# OPCIONES: osid Identificador de la base a la que consultara
# -t prefijo Prefijo de la tabla _C_PARAMETROS por omision
# es MED
# -b bloque Bloque que usara. Por omision toda la tabla
# -o salida Archivo de salida. Por omiision pantalla
# DEPENDENCIAS: descargaDATOS-sql.sh
# BUGS: ---
# NOTAS: ---
# URL: ---
# VERSIONES: 20150220 0.0.1 PetrOHS Inicial
#===============================================================================
' | more;}
#variables generales
export UTILS="utils";
. $UTILS/confs/oracle.conf
#opciones por omision
_PTC="MED_C_PARAMETROS";
_SAL="";
_BLQ="";
#leyendo opciones de linea comandos
while getopts b:o:t: _opciones
do
case "$_opciones" in
b)
_BLQ="where BLOQUE=$OPTARG";
;;
t)
_PTC="${OPTARG}_C_PARAMETROS";
;;
o)
_SAL="-o $OPTARG";
;;
?)
ayuda;
exit 2;
;;
esac
done
shift `expr $OPTIND - 1`
#ayuda
if [ "$1" = "-h" -o "$1" = "--help" -o "$1" = "--ayuda" -o -z "$1" ]
then
ayuda;
exit 1;
fi
#consulta
_OSID="$1";
sh $UTILS/descargaDATOS-sql.sh -b $_OSID -d= ${_SAL} "select PARAMETRO,VALOR from $_PTC $_BLQ order by PRIORIDAD";
#
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment