Install brew

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

The command curl with options:
-f, –fail
(HTTP) Fail silently (no output at all) on server errors. This is mostly done to better enable scripts etc to better deal with failed attempts. In normal cases when an HTTP
server fails to deliver a document, it returns an HTML document stating so (which often also describes why and more). This flag will prevent curl from outputting that and
return error 22.

This method is not fail-safe and there are occasions where non-successful response codes will slip through, especially when authentication is involved (response codes 401
and 407).

-L, –location
(HTTP/HTTPS) If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will
make curl redo the request on the new place. If used together with -i, –include or -I, –head, headers from all requested pages will be shown. When authentication is used,
curl only sends its credentials to the initial host. If a redirect takes curl to a different host, it won’t be able to intercept the user+password. See also –location-
trusted on how to change this. You can limit the amount of redirects to follow by using the –max-redirs option.

When curl follows a redirect and the request is not a plain GET (for example POST or PUT), it will do the following request with a GET if the HTTP response was 301, 302, or
303. If the response code was any other 3xx code, curl will re-send the following request using the same unmodified method.

-s, –silent
Silent or quiet mode. Don’t show progress meter or error messages. Makes Curl mute.

-S, –show-error
When used with -s it makes curl show an error message if it fails.

rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
MacBook-Pro-de-Jose:~ jmprieto$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/include
/usr/local/lib
/usr/local/share/man/man3
/usr/local/share/man/man5
/usr/local/share/man/man7
==> The following directories will have their group set to admin:
/usr/local/include
/usr/local/lib

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/include /usr/local/lib /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7
Password:
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/include /usr/local/lib
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 189633, done.
remote: Compressing objects: 100% (51766/51766), done.
remote: Total 189633 (delta 136736), reused 189572 (delta 136694)
Receiving objects: 100% (189633/189633), 37.81 MiB | 2.62 MiB/s, done.
Resolving deltas: 100% (136736/136736), done.
From https://github.com/Homebrew/homebrew
 * [new branch]      master     -> origin/master
HEAD is now at 5d4034d utils: use the $stderr global variable.
==> Installation successful!
==> Next steps
Run `brew doctor` before you install anything
Run `brew help` to get started
Install brew

Creando un script para carbondump

# !/bin/sh
#
# ejemplo de ejecucion:
# sudo ./workerDump.sh 26638
# el numero 26638 se corresponde con el pid del servidor. se puede sacar con 'ps -ef | grep java'
# en este caso habria que buscar el proceso del worker

JAVA_HOME=/usr/lib/jvm/jdk1.7.0_40
export JAVA_HOME
cd /home/wso2/wso2worker/bin/
./carbondump.sh -carbonHome /home/tecnocom/wso2/wso2worker/ -pid $1

hay que tener instalado en el sistema:
zip (sudo apt-get install zip)
– jmap

https://docs.wso2.org/display/AS510/Capturing+the+State+of+the+System+in+Error+Situations

Creando un script para carbondump

Crear KeyStores para cliente y servidor

Sigue los siguientes pasos para obtener un keystore para el cliente y el servidor. La contraseña comun a todos los certificados y keysotre sera: 18091980

Ficheros necesarios

Estos ficheros tienen que estar en la misma carpeta donde ejecutemos los comandos

Bibliografia:
wso2 documentation

Comandos

openssl req -x509 -newkey rsa:1024 -keyout cakey.pem -out cacert.pem -config openssl.cnf
Generating a 1024 bit RSA private key
........++++++
..........++++++
writing new private key to 'cakey.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [ES]:ES
State or Province Name (full name) [Pontevedra]:P
Locality Name (eg, city) []:V
Organization Name (eg, company) [SA]:T
Organizational Unit Name (eg, section) []:T
Common Name (eg, YOUR name) []:JMP
Email Address []:JMP@JMP.ES
keytool -genkey -alias client -keyalg RSA -keystore client.jks
Escriba la contraseña del almacén de claves:  18091980
Volver a escribir la contraseña nueva: 18091980
¿Cuáles son su nombre y su apellido?
  [Unknown]:  p
¿Cuál es el nombre de su unidad de organización?
  [Unknown]:  t
¿Cuál es el nombre de su organización?
  [Unknown]:  T
¿Cuál es el nombre de su ciudad o localidad?
  [Unknown]:  V
¿Cuál es el nombre de su estado o provincia?
  [Unknown]:  P
¿Cuál es el código de país de dos letras de la unidad?
  [Unknown]:  ES
¿Es correcto CN=p, OU=t, O=T, L=V, ST=P, C=ES?
  [no]:  si

Escriba la contraseña clave para <client>
        (INTRO si es la misma contraseña que la del almacén de claves):

keytool -list -v -keystore client.jks -storepass 18091980
keytool -genkey -alias service -keyalg RSA -keystore service.jks
Escriba la contraseña del almacén de claves:  18091980
Volver a escribir la contraseña nueva: 18091980
¿Cuáles son su nombre y su apellido?
  [Unknown]:  JMP
¿Cuál es el nombre de su unidad de organización?
  [Unknown]:  T
¿Cuál es el nombre de su organización?
  [Unknown]:  T
¿Cuál es el nombre de su ciudad o localidad?
  [Unknown]:  V
¿Cuál es el nombre de su estado o provincia?
  [Unknown]:  P
¿Cuál es el código de país de dos letras de la unidad?
  [Unknown]:  ES
¿Es correcto CN=JMP, OU=T, O=T, L=V, ST=P, C=ES?
  [no]:  si

Escriba la contraseña clave para <service>
        (INTRO si es la misma contraseña que la del almacén de claves):
keytool -certreq -keystore client.jks -storepass 18091980 -alias client -file client.cert.req
keytool -certreq -keystore service.jks -storepass 18091980 -alias service -file service.cert.req
openssl ca -config openssl.cnf -out service.pem -infiles service.cert.req
openssl ca -config openssl.cnf -out client.pem -infiles client.cert.req
openssl x509 -outform DER -in client.pem -out client.cert
openssl x509 -outform DER -in service.pem -out service.cert
openssl x509 -outform DER -in cacert.pem -out cacert.cert
keytool -import -file cacert.cert -keystore service.jks -storepass 18091980 -alias ca
keytool -import -file cacert.cert -keystore client.jks -storepass 18091980 -alias ca
keytool -import -file client.cert -keystore client.jks -storepass 18091980 -alias client
keytool -import -file service.cert -keystore service.jks -storepass 18091980 -alias service
keytool -import -file client.cert -keystore service.jks -storepass 18091980 -alias client
keytool -import -file service.cert -keystore client.jks -storepass 18091980 -alias service

openssl.cnf

#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#

# This definition stops the following lines choking if HOME isn't
# defined.
HOME			= .
RANDFILE		= $ENV::HOME/.rnd

# Extra OBJECT IDENTIFIER info:
#oid_file		= $ENV::HOME/.oid
oid_section		= new_oids

# To use this configuration file with the "-extfile" option of the
# "openssl x509" utility, name here the section containing the
# X.509v3 extensions to use:
# extensions		= 
# (Alternatively, use a configuration file that has only
# X.509v3 extensions in its main [= default] section.)

[ new_oids ]

# We can add new OIDs in here for use by 'ca' and 'req'.
# Add a simple OID like this:
# testoid1=1.2.3.4
# Or use config file substitution like this:
# testoid2=${testoid1}.5.6

####################################################################
[ ca ]
default_ca	= CA_default		# The default ca section

####################################################################
[ CA_default ]

dir		= .			# Where everything is kept
certs		= $dir/certs		# Where the issued certs are kept
crl_dir		= $dir/crl		# Where the issued crl are kept
database	= $dir/index.txt	# database index file.
#unique_subject	= no			# Set to 'no' to allow creation of
					# several ctificates with same subject.
new_certs_dir	= $dir  		# default place for new certs.

certificate	= $dir/cacert.pem 	# The CA certificate
serial		= $dir/serial 		# The current serial number
#crlnumber	= $dir/crlnumber	# the current crl number must be
					# commented out to leave a V1 CRL
crl		= $dir/crl.pem 		# The current CRL
private_key	= $dir/cakey.pem# The private key
RANDFILE	= $dir/private/.rand	# private random number file

x509_extensions	= usr_cert		# The extentions to add to the cert

# Comment out the following two lines for the "traditional"
# (and highly broken) format.
name_opt 	= ca_default		# Subject Name options
cert_opt 	= ca_default		# Certificate field options

# Extension copying option: use with caution.
# copy_extensions = copy

# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
# so this is commented out by default to leave a V1 CRL.
# crlnumber must also be commented out to leave a V1 CRL.
# crl_extensions	= crl_ext

default_days	= 365			# how long to certify for
default_crl_days= 30			# how long before next CRL
default_md	= md5			# which md to use.
preserve	= no			# keep passed DN ordering

# A few difference way of specifying how similar the request should look
# For type CA, the listed attributes must be the same, and the optional
# and supplied fields are just that 🙂
policy		= policy_match

# For the CA policy
[ policy_match ]
countryName		= match
stateOrProvinceName	= match
organizationName	= match
organizationalUnitName	= optional
commonName		= supplied
emailAddress		= optional

# For the 'anything' policy
# At this point in time, you must list all acceptable 'object'
# types.
[ policy_anything ]
countryName		= optional
stateOrProvinceName	= optional
localityName		= optional
organizationName	= optional
organizationalUnitName	= optional
commonName		= supplied
emailAddress		= optional

####################################################################
[ req ]
default_bits		= 1024
default_keyfile 	= privkey.pem
distinguished_name	= req_distinguished_name
attributes		= req_attributes
x509_extensions	= v3_ca	# The extentions to add to the self signed cert

# Passwords for private keys if not present they will be prompted for
# input_password = secret
# output_password = secret

# This sets a mask for permitted string types. There are several options. 
# default: PrintableString, T61String, BMPString.
# pkix	 : PrintableString, BMPString.
# utf8only: only UTF8Strings.
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
# MASK:XXXX a literal mask value.
# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
# so use this option with caution!
string_mask = nombstr

# req_extensions = v3_req # The extensions to add to a certificate request

[ req_distinguished_name ]
countryName			= Country Name (2 letter code)
countryName_default		= LK
countryName_min			= 2
countryName_max			= 2

stateOrProvinceName		= State or Province Name (full name)
stateOrProvinceName_default	= Some-State

localityName			= Locality Name (eg, city)

0.organizationName		= Organization Name (eg, company)
0.organizationName_default	= Internet Widgits Pty Ltd

# we can do this but it is not needed normally 🙂
#1.organizationName		= Second Organization Name (eg, company)
#1.organizationName_default	= World Wide Web Pty Ltd

organizationalUnitName		= Organizational Unit Name (eg, section)
#organizationalUnitName_default	=

commonName			= Common Name (eg, YOUR name)
commonName_max			= 64

emailAddress			= Email Address
emailAddress_max		= 64

# SET-ex3			= SET extension number 3

[ req_attributes ]
challengePassword		= A challenge password
challengePassword_min		= 4
challengePassword_max		= 20

unstructuredName		= An optional company name

[ usr_cert ]

# These extensions are added when 'ca' signs a request.

# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.

basicConstraints=CA:FALSE

# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.

# This is OK for an SSL server.
# nsCertType			= server

# For an object signing certificate this would be used.
# nsCertType = objsign

# For normal client use this is typical
# nsCertType = client, email

# and for everything including object signing:
# nsCertType = client, email, objsign

# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment

# This will be displayed in Netscape's comment listbox.
nsComment			= "OpenSSL Generated Certificate"

# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer:always

# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName=email:copy
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName=email:move

# Copy subject details
# issuerAltName=issuer:copy

#nsCaRevocationUrl		= http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName

[ v3_req ]

# Extensions to add to a certificate request

basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment

[ v3_ca ]


# Extensions for a typical CA


# PKIX recommendation.

subjectKeyIdentifier=hash

authorityKeyIdentifier=keyid:always,issuer:always

# This is what PKIX recommends but some broken software chokes on critical
# extensions.
#basicConstraints = critical,CA:true
# So we do this instead.
basicConstraints = CA:true

# Key usage: this is typical for a CA certificate. However since it will
# prevent it being used as an test self-signed certificate it is best
# left out by default.
# keyUsage = cRLSign, keyCertSign

# Some might want this also
# nsCertType = sslCA, emailCA

# Include email address in subject alt name: another PKIX recommendation
# subjectAltName=email:copy
# Copy issuer details
# issuerAltName=issuer:copy

# DER hex encoding of an extension: beware experts only!
# obj=DER:02:03
# Where 'obj' is a standard or added object
# You can even override a supported extension:
# basicConstraints= critical, DER:30:03:01:01:FF

[ crl_ext ]

# CRL extensions.
# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.

# issuerAltName=issuer:copy
authorityKeyIdentifier=keyid:always,issuer:always

serial

01

index.txt

empty-vacio-sin_nada
Crear KeyStores para cliente y servidor

javac classpath multiple jars

Tengo esto en mi directorio:

 CividasSara.jar
 Main.java
 cividas.jar
 cividasnotifications.jar
 ontimizeEN.jar
 ontimizeWeb.jar
 salida.out
 util-java.jar
 workflowEN.jara

Quiero compilar Main.java (crear Main.class):

WINDOWS
javac -cp "cividas.jar;cividasnotifications.java;CividasSara.jar;ontimizeEN.jar;ontimizeWeb.jar;util-java.jar;workflowEN.jar;." Main.java
LINUX
javac -cp "cividas.jar:cividasnotifications.java:CividasSara.jar:ontimizeEN.jar:ontimizeWeb.jar:util-java.jar:workflowEN.jar:." Main.java

Con lo que ya se ha generado el compilado:

 CividasSara.jar
 Main.class
 Main.java
 cividas.jar
 cividasnotifications.jar
 ontimizeEN.jar
 ontimizeWeb.jar
 salida.out
 util-java.jar
 workflowEN.jara

Ahora quiero ejecutarlo:

WINDOWS
java -cp "cividas.jar;cividasnotifications.java;CividasSara.jar;ontimizeEN.jar;ontimizeWeb.jar;util-java.jar;workflowEN.jar;." Main
LINUX
java -cp "cividas.jar:cividasnotifications.java:CividasSara.jar:ontimizeEN.jar:ontimizeWeb.jar:util-java.jar:workflowEN.jar:." Main

ANEXO I

Ejecucion de una clase, pasando un parametro como argumento. Mantenemos las librerias en el classpath.

$ java -cp "cividas.jar:cividasnotifications.java:CividasSara.jar:ontimizeEN.jar:ontimizeWeb.jar:util-java.jar:workflowEN.jar:." es.tecnocom.tsafirma.AFirmaImpl Factura-e_2013092520130925.xml

ANEXO II

El Anexo I en un script bash.

#!/bin/bash

java -cp "bduac.jar:cividas.jar:cividasnotifications.jar:CividasSara.jar:commons-beanutils.jar:commons-collections.jar:commons-digester.jar:commons-fileupload.jar:commons-io.jar:commons-lang.jar:commons-logging.jar:jboss-el-2.0.0.GA.jar:jdom-2.0.1.jar:jsf-api-2.1.3-b02.jar:jsf-impl-2.1.3-b02.jar:jstl-1.2.jar:liferay-faces-bridge-api-3.1.1-ga2.jar:liferay-faces-bridge-impl-3.1.1-ga2.jar:liferay-faces-portal-3.1.1-ga2.jar:liferay-faces-util-3.1.1-ga2.jar:log4j.jar:Main.class:Main.java:ontimizeEN.jar:ontimizeWeb.jar:recaptcha4j-0.0.7.jar:util-bridges.jar:util-java.jar:util-taglib.jar:workflowEN.jar:portal-service-6.1.1.jar:tsafirma.jar:." es.tecnocom.tsafirma.AFirmaImpl $1 >> logPruebaSelladoTiempo.log && less -Ss logPruebaSelladoTiempo.log

tambien se puede poner al final en lugar de less: «tail -2», para mostrar solo el resultado

Hay que dar permisos, y ejecutar…

chmod 775 ejecuta.sh
./ejecuta.sh ficheroASellar.xml
javac classpath multiple jars

Subversion en consola

descargar un proyecto a la carpeta local:
svn checkout https://(projectname).(domain)/svn/(projectname)/(DIR) (projectname) –username [type-user-name-here]

svn add: añadir un fichero.
svn revert: si te equivocas.
svn blame: viendo el contenido de archivos específicos con la información de revisión y autor.
svn cat: ver el contenido de un archivo específico.
svn cleanup: destrabando una copia de trabajo.
svn copy: copiar un archivo o directorio en la copia de trabajo o en el repositorio.
svn delete/del/remove/rm: borrar un archivo o directorio desde tu copia local.
svn diff file1 file2: ver las diferencias entre archivos.
para comparar el archivo modificado localmente «index.php» contra el que se encuentra en el repositorio, debes tipear:
svn diff $SRC/…../index.html https://(projectname).(domain)/svn/(projectname)/trunk (projectname) –username [type-user-name-here]
svn diff -r 456:459 subfn.cpp
svn export: exportar un directorio limpio de archivos .svn a tu máquina local.
Con este comando puedes extraer una copia sin versionar (sin los archivos .svn) del proyecto, para obtener el directorio sin versionar de cualquier revisión debes escribir:
svn export [-r REV] [PATH]
svn help: ver la ayuda de subversion.
svn commit: subiendo tus cambios.
svn commit -m «Type your comment here» [files]
svn import: importando un archivo o directorio sin versionar al repositorio.
svn info: mostrar información acerca de paths en tu copia de trabajo.
svn list: listar los directorios en el repositorio.
svn log: mostrando los mensajes de log de los commits.
svn log -v .
svn log -r RevisionNumber http://URL/path/file
svn log -l 4 (solo las ultimas 4 entradas)
svn log -v –limit 4 (verbose)
svn log -r 1:HEAD (To list everything in ascending order)
svn log -r HEAD:1 (To list everything in descending order)
svn log -r 13:BASE (To list everything from the thirteenth to the base of the currently checked-out revision in ascending order)
svn log -r {2011-02-02}:{2011-02-03} (To get everything between the given dates)

svn merge: fusionado cambios.
svn mkdir: creando un nuevo directorio.
svn move: moviendo un archivo o directorio.
svn resolved: resolviendo conflictos.
svn status: obteniendo el estado de un archivo o directorio.
svn update: actualizando tu copia de trabajo.

Explicacion de las columnas:
The first column
‘ ‘: No modifications.
‘A’: Item is scheduled for Addition.
‘D’: Item is scheduled for Deletion.
‘M’: Item has been modified.
‘R’: Item has been replaced in your working copy. This means the file was scheduled for deletion, and then a new file with the same name was scheduled for addition in its place.
‘C’: The contents (as opposed to the properties) of the item conflict with updates received from the repository.
‘X’: Item is related to an externals definition.
‘I’: Item is being ignored (e.g. with the svn:ignore property).
‘?’: Item is not under version control.
‘!’: Item is missing (e.g. you moved or deleted it without using svn). This also indicates that a directory is incomplete (a checkout or update was interrupted).
‘~’: Item is versioned as one kind of object (file, directory, link), but has been replaced by different kind of object.

The second column tells the status of a file’s or directory’s properties.
‘ ‘: No modifications.
‘M’: Properties for this item have been modified.
‘C’: Properties for this item are in conflict with property updates received from the repository.

The third column is populated only if the working copy directory is locked. (See the section called “svn cleanup”.)
‘ ‘: Item is not locked.
‘L’:Item is locked.

The fourth column is populated only if the item is scheduled for addition-with-history.
‘ ‘:No history scheduled with commit.
‘+’: History scheduled with commit.

The fifth column is populated only if the item is switched relative to its parent (see the section called “Switching a Working Copy”).
‘ ‘: Item is a child of its parent directory.
‘S’: Item is switched.

The sixth column is populated with lock information.
‘ ‘: When –show-updates is used, the file is not locked. If –show-updates is not used, this merely means that the file is not locked in this working copy.
K: File is locked in this working copy.
O: File is locked either by another user or in another working copy. This only appears when –show-updates is used.
T: File was locked in this working copy, but the lock has been “stolen”and is invalid. The file is currently locked in the repository. This only appears when –show-updates is used.
B: File was locked in this working copy, but the lock has been “broken”and is invalid. The file is no longer locked This only appears when –show-updates is used.

The out-of-date information appears in the seventh column (only if you pass the –show-updates switch).
‘ ‘: The item in your working copy is up-to-date.
‘*’: A newer revision of the item exists on the server.

Realizar un tag:
svn copy http://host/repos/project/trunk http://host/repos/project/tags/TagName-1.4.5 -m «Tag Release 1.4.5»

Para darle un toque de color:
https://github.com/jmlacroix/svn-color/blob/master/svn-color.sh

Subversion en consola

Haciendo mas con LESS

-M     muestra las lineas del documento, en la que te encuentras y el porcentaje de documento leido. En la parte inferior de la pantalla.
-N        muestra los numeros de linea
-s         junta las lineas en blanco
-S         corta las lineas largas

dentro del comando:
v:                 abre el editor vi.

q  :q  Q  :Q  ZZ     Salir de la aplicacion.
h  H              Muestra la ayuda.
e                    Avanza una linea a mas.
y                    Retrocede una linea o mas.
f                     Avanza una ventana.
b                   Retrocede una ventana.
d                   Avanza media ventana.
u                   Retrocede media ventana.
F                   como ‘tail -f’
r                    repinta la pantalla.

/pattern      busqueda hacia adelante
?pattern      busqueda hacia atras
n                   avanza hasta la siguiente
N                  retrocede a la anterior
&pattern     muestra solo las lineas que coinciden

g                   retrocede a la primera linea del fichero.
G                  avanza hasta el final del fichero
{([                busca la apertura de parentesis
})]                busca el cierre de parentesis

m<letter>            marcar una posicion con una letra
‘<letter>               ir la marca anterior
»                             ir a la posicion anterior.

^              significa el principio de una linea
$              significa el final de una linea

:e[file]            examinar otro fichero
:f                      muestra el nombre del fichero

trabajar con varios ficheros a la vez
less /var/log/syslog /var/log/kern.log /var/log/dmesg
:n     examina el siguiente fichero
:p     examina el fichero anterior
:d     elimina el fichero de la lista de ficheros

Haciendo mas con LESS

Windows7 script bash, reemplazar

@ECHO OFF
REM -----------------------------------------------------------------------
REM Elimina una carpeta y la sustituye por otra
REM -----------------------------------------------------------------------

ECHO # process START at %date% %time% --------------------------------- >> C:Proyectosdepoi-networkspace_branchreemplazaMetadata.log
ECHO Eliminando C:Proyectosdepoi-networkspace_branch.metadata
ECHO Eliminando C:Proyectosdepoi-networkspace_branch.metadata >> C:Proyectosdepoi-networkspace_branchreemplazaMetadata.log

rmdir /S/Q C:Proyectosdepoi-networkspace_branch.metadata
Exit Code = %ERRORLEVEL% > nul
if "%ERRORLEVEL%" == "0" echo ...ACIERTO >> C:Proyectosdepoi-networkspace_branchreemplazaMetadata.log
if not "%ERRORLEVEL%" == "0" echo ...ERROR >> C:Proyectosdepoi-networkspace_branchreemplazaMetadata.log
if "%ERRORLEVEL%" == "0" echo ...ACIERTO
if not "%ERRORLEVEL%" == "0" echo ...ERROR

ECHO Copiando... C:Proyectosdepoi-networkspace_branch.metadata
ECHO Copiando... C:Proyectosdepoi-networkspace_branch.metadata >> C:Proyectosdepoi-networkspace_branchreemplazaMetadata.log

set source=C:Proyectosdepoi-networkspace_branch_metadata_BEST_PROYECTOS
set destination=C:Proyectosdepoi-networkspace_branch.metadata
robocopy %source% %destination% /e >> reemplazaMetadata.log

Exit Code = %ERRORLEVEL% > nul
if "%ERRORLEVEL%" == "0" echo ...ACIERTO >> C:Proyectosdepoi-networkspace_branchreemplazaMetadata.log
if not "%ERRORLEVEL%" == "0" echo ...ERROR >> C:Proyectosdepoi-networkspace_branchreemplazaMetadata.log
if "%ERRORLEVEL%" == "0" echo ...ACIERTO
if not "%ERRORLEVEL%" == "0" echo ...ERROR

ECHO # process END --------------------------------------------------- >> C:Proyectosdepoi-networkspace_branchpackageDeploy.log

timeout /T 5

exit

Guardar como: reemplazarMetada.bat
Ejecutar como:
– con el raton pinchar dos veces
– en la consola de windows, (ir hasta el directorio que contiene el fichero), ejecutar: reemplazarMetada

Windows7 script bash, reemplazar

Windows7 bash script, borrar directorios, fichero

@ECHO OFF
REM -----------------------------------------------------------------------
REM Borra una serie de directorios para que no tenga que hacerlos a mano
REM -----------------------------------------------------------------------

ECHO # process START at %date% %time% --------------------------------- >> C:Proyectosdepoi-networkspace_branchdeleteFiles.log
ECHO Eliminando carpetas y ficheros:
ECHO Eliminando carpetas y ficheros: >> C:Proyectosdepoi-networkspace_branchdeleteFiles.log

set folder="C:Softwareliferayliferay-portal-6.1.1-ce-ga2tomcat-7.0.27logs"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q) >> C:Proyectosdepoi-networkspace_branchdeleteFiles.log

set folder="C:Softwareliferayliferay-portal-6.1.1-ce-ga2tomcat-7.0.27temp"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q) >> C:Proyectosdepoi-networkspace_branchdeleteFiles.log

set folder="C:Softwareliferayliferay-portal-6.1.1-ce-ga2tomcat-7.0.27workCatalina"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q) >> C:Proyectosdepoi-networkspace_branchdeleteFiles.log

rmdir /S/Q C:Softwareliferayliferay-portal-6.1.1-ce-ga2tomcat-7.0.27webappsfacturae-portlet >> C:Proyectosdepoi-networkspace_branchdeleteFiles.log

set folder="C:Softwareliferayliferay-portal-6.1.1-ce-ga2deploy"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q) >> C:Proyectosdepoi-networkspace_branchdeleteFiles.log

set folder="C:Softwareliferayliferay-portal-6.1.1-ce-ga2logs"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q) >> C:Proyectosdepoi-networkspace_branchdeleteFiles.log

set folder="C:UsersE01740AppDataLocalTemp"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q) >> C:Proyectosdepoi-networkspace_branchdeleteFiles.log

set folder="C:WindowsTemp"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q) >> C:Proyectosdepoi-networkspace_branchdeleteFiles.log

set folder="C:Proyectosdepoi-networkspace_branchfacturaefacturae-portletstarget"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q) >> C:Proyectosdepoi-networkspace_branchdeleteFiles.log

REM -- set folder=""
REM -- cd /d %folder%
REM -- for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)

ECHO # process END --------------------------------------------------- >> C:Proyectosdepoi-networkspace_branchpackageDeploy.log
echo "Puedes revisar el log para comprobar que todo se ha eliminado correctamente"
timeout /T 5

exit

Guardar como: borraLiferaProjectTemp.bat
Ejecutar como:
– con el raton pinchar dos veces
– en la consola de windows, (ir hasta el directorio que contiene el fichero), ejecutar: borraLiferaProjectTemp

Windows7 bash script, borrar directorios, fichero

Ejecucion de maven a traves de un script de windows

@ECHO OFF
REM -----------------------------------------------------------------------
REM Ejecucion del proceso maven: mvn clean package -Dmaven.test.skip=true
REM y se copia el war generado a la carpeta deploy de liferay
REM se hace uso de este script porque creo que es al ejecutar este comando
REM en eclipse cuando se me jode el invento
REM -----------------------------------------------------------------------

REM write to log file
ECHO # process START at %date% %time% --------------------------------- >> C:Proyectosdepoi-networkspace_branchpackageDeploy.log
ECHO Ejecutando: mvn clean package -Dmaven.test.skip=true
ECHO Ejecutando: mvn clean package -Dmaven.test.skip=true >> C:Proyectosdepoi-networkspace_branchpackageDeploy.log

set folder="C:Proyectosdepoi-networkspace_branchfacturaefacturae-portlets"
cd /d %folder%
call mvn clean package -Dmaven.test.skip=true >> C:Proyectosdepoi-networkspace_branchpackageDeploy.log
ECHO Exit Code = %ERRORLEVEL% > nul
if "%ERRORLEVEL%" == "0" echo "El Proceso Maven(mvn clean package -Dmaven.test.skip=true) ha funcionado perfectamente" >> C:Proyectosdepoi-networkspace_branchpackageDeploy.log
if not "%ERRORLEVEL%" == "0" echo "ERROR al ejecutar:mvn clean package -Dmaven.test.skip=true" >> C:Proyectosdepoi-networkspace_branchpackageDeploy.log

if "%ERRORLEVEL%" == "0" echo ...ACIERTO
if not "%ERRORLEVEL%" == "0" echo ...ERROR

ECHO Ejecutando: la copia del war a la carpeta deploy de liferay
ECHO Ejecutando: la copia del war a la carpeta deploy de liferay >> C:Proyectosdepoi-networkspace_branchpackageDeploy.log

set folder="C:Proyectosdepoi-networkspace_branchfacturaefacturae-portletstarget"
cd /d %folder%
set source=C:Proyectosdepoi-networkspace_branchfacturaefacturae-portletstargetfacturae-portlets-0.1.0-SNAPSHOT.war
set destination=C:Softwareliferayliferay-portal-6.1.1-ce-ga2deploy
xcopy %source% %destination% >> C:Proyectosdepoi-networkspace_branchpackageDeploy.log

ECHO Exit Code = %ERRORLEVEL% > nul
if "%ERRORLEVEL%" == "0" echo ...ACIERTO >> C:Proyectosdepoi-networkspace_branchpackageDeploy.log
if not "%ERRORLEVEL%" == "0" echo ...ERROR >> C:Proyectosdepoi-networkspace_branchpackageDeploy.log

if "%ERRORLEVEL%" == "0" echo ...ACIERTO
if not "%ERRORLEVEL%" == "0" echo ...ERROR

ECHO # process END --------------------------------------------------- >> C:Proyectosdepoi-networkspace_branchpackageDeploy.log

timeout /T 5
exit

Guardar como: packageAndDeploy.bat
Ejecutar como:
– con el raton pinchar dos veces
– en la consola de windows, (ir hasta el directorio que contiene el fichero), ejecutar: packageAndDeploy

Ejecucion de maven a traves de un script de windows