martes, 13 de noviembre de 2007

linux script copias seguridad

estos scripts se activan desde el archivo crontab


copidatabases.sh (mysql)

#!/bin/sh
fecha=$(date +%y-%m-%d-%H-%M)
DIRECTORIO_INICIAL=/var/lib/mysql
DIRECTORIO_FINAL=$1

mkdir $DIRECTORIO_FINAL/$fecha
for a in `ls $DIRECTORIO_INICIAL`
do
fname=`echo $a | tr A-Z a-z`

echo $DIRECTORIO_INICIAL/$a $DIRECTORIO_INICIAL/$fname
/usr/bin/mysqldump -u ADMIN --password=nickel $fname>$DIRECTORIO_FINAL/$fecha/$fname.sql
done;
exit 0

copi.sh (directorios a incluir y tar)
#!/bin/sh
DIAS=$3
DIRECTORIO_INICIAL=$1
DIRECTORIO_FINAL=$2
fecha=$(date +%y-%m-%d-%H-%M)
find $DIRECTORIO_INICIAL -mtime -$DIAS \! -type d | cat > $DIRECTORIO_FINAL$fecha.txt
tar -cv -T $DIRECTORIO_FINAL$fecha.txt -f $DIRECTORIO_FINAL$fecha.tar

jueves, 8 de noviembre de 2007

cache de explorer no busca actualizacion de informacion

En herramientas>opciones de internet
pestaña general, información relativa a archivos temporales de internet> configuración
Comprobar: automaticamente

o eso o mandar un parametro en el get que sea por ejemplo la hora

miércoles, 24 de octubre de 2007

enum con propiedades, para controlar los mensajes al usuario

http://java.sun.com/docs/books/tutorial/java/javaOO/enum.html

public enum ReflectionMensaje {
ILEGAL_ACCESO("ilegal acceso al metodo: "),
METODO_INEXISTENTE("No existe el metodo: "),
EXCEPCION_INVOCACION("excepcion de invocacion en el metodo: ");

private final String mensaje; // in kilograms

ReflectionMensaje(String m) {
this.mensaje = m;
}

public String toString() {
return mensaje; //To change body of overridden methods use File | Settings | File Templates.
}
}

jueves, 18 de octubre de 2007

configure log en jboss

hay que editar el archivo server/default/conf/log4j.xml
e incluir nuevas categorias

<category name="oracle.adf">
<priority value="WARN"/>
</category>

martes, 16 de octubre de 2007

jndiPatter en components.xml

<component name="org.jboss.seam.core.init">
< property> name="jndiPattern" pruebaSevilla/#{ejbName}/local/ <property>
</component>

miércoles, 10 de octubre de 2007

Acceder a componente stateless de seam

como es un componente sin estado no se puede acceder a través de la función:
Contexts.getSessionContext()
entonces:
Component.getInstance(nombre);

jueves, 4 de octubre de 2007

How to specify platform independent file path?

How to specify platform independent file path?
WINDOWS
File.separatorChar: \
File.separator: \
File.pathSeparator: ;
File.pathSeparatorChar: ;

LINUX
File.separatorChar: /
File.separator: /
File.pathSeparator: ;
File.pathSeparatorChar: ;


Y una función para obtener el path url del archivo:
protected String damePathURL(String serverPathFile){
try{
return serverPathFile.replaceAll(File.separator, "/");
}catch(Exception e){
//lanzaría una excepción de tipo java.util.regex.PatternSyntaxException al intentar sustituir el File.Separator=\
return serverPathFile.replaceAll(File.separator+File.separator, "/");
}
}