Mar 08 2007

The Deployment scanner - jboss

Catégorie : Web & J2EE server, Jboss, Tips and tricksCharles Collier @ 1:13 am

Start

The conf/jboss-service.xml file is full of options. One of these ones is about the deployment scanner. If you make any change in a jboss config file then you’ll have to restart the server.

Open the conf/jboss-service.xml in vi or some text editor capable of saving in plain text. Scroll near the bottom to the MBean definition for the DeploymentScanner:

Deployment Sorter

As you scroll down you should see some comments followed by this:

org.jboss.deployment.DeploymentSorter

This is the deployment sorter which enforces the default deployment order. Starting from 4.0.1, it gets the sort order from the MainDeployerss EnhancedSuffixOrder. If you prefer a UNIX System-V init style you can comment this sorter and uncomment the following line:

org.jboss.deployment.scanner.PrefixDeploymentSorter

This sorter will use a numeric prefix-based order. If you wish to use this sort, you should read further on the prefix deployment order.

Scan Period

As you scroll further you will find:

5000

The default value is 5000 milliseconds or 5 seconds. This determines how frequently the directories which the Deployment Scanner is watching (/deploy) will be polled. Of course it very usefull when you are under development. But when you a production server this option should be disable (because of waste CPU, or protect from unwanted productions changes)

URLs

As you scroll further you will find:

deploy/

It will defined where data (such as .ear or .war) for hot deployments will be used.
It could even be http://url or webdav url.
For example, if you wanted to protect the database passwords you might do this:

deploy/,datasources/

You could set the file system permissions on datasources/ such that JBoss could read them, but developers could not.

Recursive

Finally, you should see:

True

This will cause the deployment scanner to recurse into subdirectories. Read this for more informaton on the drawbacks.

Disable Hot Deployment

Add the following attribute:

false

Mar 06 2007

Export script - beginners

Catégorie : Database, Oracle Database, OracleCharles Collier @ 12:17 am

Here is a very simple script to save an Oracle database with a full export script.
It’s a very basic example, because there is no log and no option (only a full export)
Ina few days i’ll post a more detailled export script.

#!/bin/bash
#—————————#
# Oracle Full export script #
# Nuxora v1.0 #
#—————————#

# set env
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
export ORACLE_SID=$1
when=`date +”%d%m”`

# export
exp expimp/$2 file=”$ORACLE_BACKUP”/admin/exp/full/$ORACLE_SID/exp”$when”_”$ORACLE_SID”_”FULL”.dmp FULL=Y ROWS=Y

# keep only 7 days
for file in `find “$ORACLE_BACKUP/admin/exp/full/$ORACLE_SID” -name “exp*.dmp” -mtime +7 -print`
do
echo $file
rm $file
done


Mar 06 2007

Sendmail: quick start

Catégorie : sysadmin, LinuxCharles Collier @ 12:06 am

First you have to edit the config file
vi /etc/mail/sendmail.mc
you have to know your smtp server:


dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
define(`SMART_HOST’,`serverSMTP’)
dnl #
define(`confDEF_USER_ID’,“8:12”)dnl
dnl define(`confAUTO_REBUILD’)dnl
define(`confTO_CONNECT’, `1m’)dnl

Then, generate the .cf file with ‘m4′ tool:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

You now have a new config file for our sendmail daemon
Then, restart sendmail:
/etc/init.d/sendmail restart


Feb 28 2007

Working with TAF - Transparent Application Fail-Over

Catégorie : Database, Oracle Database, OracleCharles Collier @ 12:20 pm

I’ll try to write a tutorial on TAF, it seems to be very efficient but i’ve never really used it in real condition, just test. If you want to connect to TAFTEST, first it will try ton connect to NUXORA01, if something’s wrong it will try to connect to NUXORA02

DBPROD =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = NUXORA01)(PORT = 1521))
(CONNECT_DATA =
(SID = ORADB01)
)
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = NUXORA02)(PORT = 1521))
(CONNECT_DATA =
(SID = ORADB02)
)
)
)

Feb 22 2007

Lister un répertoire de manière sélective

Catégorie : Tips and tricks, LinuxCharles Collier @ 9:27 pm

Le plus souvent on utilisera grep
$ ls -l backup/2007 | grep Feb

mais parfois il peut s’aveer plus utile d’utliser awk
$ ls -l backup/2007 | awk ‘$6 == “Feb”‘


Feb 22 2007

Apache - Directive Listen

Catégorie : Apache, Web & J2EE serverCharles Collier @ 9:17 pm

Au moment de son démarrage, Apache ecoute sur un port et à une IP definié dans http.conf
Par defaut il ecoute sur toutes les adresses IP et sur le port 80
Il est possible de créer des combinaisons IP/port. Cette possibilité peut s’averer utile dans le cadre de la definiton de Virtual hosts

Par exemple:

pour que Apache accepte les connexions sur les ports 80 et 8080:

Listen 80
Listen 8080

Pour que Apache accepte les connexions sur deux combinaisons IP/ports précises:

Listen 192.168.1.1:80
Listen 192.168.1.20:8080


Feb 22 2007

create a directory tree

Catégorie : Tips and tricks, sysadmin, LinuxCharles Collier @ 9:14 pm

If you want to quick, don’t forget to use the ‘-p’ option

wrong way:
[john@host john]$ mkdir dev
[john@host john]$ cd dev
[john@host dev]$ mkdir first
[john@host dev]$ cd first
[john@host first]$ mkdir alpha
[john@host dev]$ mkdir second
[john@host dev]$ ll
[john@host dev]$ cd ..
[john@host john]$ mkdir prod
[john@host john]$ cd prod
[john@host prod]$ mkdir first
[john@host prod]$ mkdir second

good way:
[john@host john]$ mkdir -p dev/first/alpha

best way:
[john@host john]$ mkdir -p dev/{first/alpha,second},prod/{first,second}


Feb 21 2007

How to extract files from a tar.gz

Catégorie : Tips and tricks, LinuxCharles Collier @ 1:47 pm

usually people do:
$ cd backup/2007/02
$ tar -zxvf data.tar.gz

you can simply do:
tar -zxvf -C backup/2007/02 data.tar.gz

or even do it better:
cd backup/2007/02 && tar -zxvf data.tar.gz

the best way:
cd backup/2007/02 || mkdir -p backup/2007/02 && tar -zxvf data.tar.gz


« Page précédentePage suivante »