Entradas

Mostrando entradas de septiembre, 2013

[PYTHON] Envolver rsync

#!/usr/bin/env python #Envolver rsync para sincronizar directorios from subprocess import call import sys source = "/home/oracle/dir1/" target = "oracle@stan:/home/oracle/dir1" rsync = "rsync" arguments = "-a" cmd = "%s %s %s %s " % (rsync, arguments, source, target) def sync(): ret = call(cmd, shell=True) if ret != 0: print "rsync failed" sys.exit(1) sync()

[PYTHON] Communicating with a SQL*Plus process from Python

#!/usr/bin/python import os from subprocess import Popen, PIPE sqlplus = Popen(["sqlplus", "-S", "/", "as", "sysdba"], stdout=PIPE, stdin=PIPE) sqlplus.stdin.write("select sysdate from dual;"+os.linesep) sqlplus.stdin.write("select count(*) from all_objects;"+os.linesep) out, err = sqlplus.communicate() print out

[PYTHON] Python + Oracle

Imagen
Url´s: http://www.oracle.com/technetwork/topics/scripting-languages/whatsnew/index-083918.HTML http://www.oracle.com/technetwork/articles/dsl/mastering-oracle-python-1391323.HTML Obtener cx_Oracle: http://cx-oracle.sourceforge.net/ Instalar el paquete rpm correspondiente, por ejemplo:                                 rpm -ivhU cx_Oracle-5.1.2-10g-py26-1.x86_64.rpm Si se produce el siguiente error al lanzar el interprete de python: [oracle@oel6 ~]$ python Python 2.6.6 (r266:84292, Sep 11 2012, 05:13:24) [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import cx_Oracle Traceback (most recent call last):   File " ", line 1, in ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or directory Es debido a que falta cargar la variable de entorno LD_LIBRARY_PATH (además del ORACLE_HOME) export LD_LIBRARY_PA

[Unix] Comando para matar (kill) varios procesos (pid)

Ejemplo de comando para matar varios procesos Oracle. Filtra los procesos servidores Oracle (shadow) de conexiones remotas (local=no) y las mata. kill -9 `ps -ef|grep -i local=no|awk '{print $2}'|xargs`

[Ubuntu] Configuración del teclado

sudo dpkg-reconfigure keyboard-configuration