Entries list

grep contain and not contain

How to find all files containing "yyy" and also not containing "zzz" for each files matching "yyy" ? Resolved with 2 grep.

grep regex containing 'yyy' but not containing 'zzz' :

  1. First, finding all files containing 'yyy', and keep in one file
grep -r -l "yyy" /c/folder/ > grepsearch.txt
  1. Second, call this script : grepsearch.sh who is looping on first result file and search number of occurencies of the second search 'zzz'
for file in `cat grepsearch.txt`; do 
   # echo "---------------------------------------------------------- $file"; 
   grepcount=$(grep -c 'zzz' $file); 
#   echo $grepcount $file; 
   if [ $grepcount -eq 0 ]
   then
#      echo "No matching search zzz";
      echo $file;
#   else
#      echo "Match search zzz";
   fi
done

Note : if your search contain "\" add a second : "\\"

Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration

[core:alert] /var/www/mywebsite/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration

To simply solve this problem, use the following two commands for add the required and currently missing Apache module:

  1. a2enmod headers # Enabling headers Module
  2. apache2ctl restart # Restarting Apache

Lire la suite

JBoss6 serve external file static content docBase vhost

There are no more "virtual directories" in JBoss 6. Apparently this went out with JBoss 5. The only availables options or solutions I've found are :

  • Way 1 : using 2 war, one for your project, one other to publish static files (under another
  • Way 2 : symlink (to a simple file system or on a war folder with inside a blank /WEB-INF)

Using ExternalDirectories doesn't work with JBoss 6

<Host name="localhost" ...>
        <!-- ADD static images DIRECTORY -->
        <Context path="/images" 
                docBase="/home/myuser/images"
                reloadable="true">
        </Context>
        <!-- The rest of your Host entity -->
</Host>

This Context deployement result :

ERROR [AbstractKernelController] Error installing to Start: name=WebServer state=Create: org.jboss.xb.binding.JBossXBException: Failed to parse source: xml_stream@163,112

Caused by: org.jboss.xb.binding.JBossXBRuntimeException: DefaultContext not found as a child of Host in unordered_sequence: Listener* Valve* Alias* Realm? attributes?

Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Context not found as a child of Host in unordered_sequence: Listener* Valve* Alias* Realm? attributes?

Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Context not found as a child of Context in unordered_sequence: Valve* Parameters* Loader? Overlay* InstanceListener* WrapperListener* Listener* SessionCookie? WrapperLifecycle* Manager? Realm? attributes? Resources?

DEPLOYMENTS IN ERROR:
 Deployment "WebServer" is in error due to the following reason(s): **ERROR**, org.jboss.xb.binding.JBossXBRuntimeException: DefaultContext not found as a child of Host in unordered_sequence: Listener* Valve* Alias* Realm? attributes?
 Deployment "jboss.web:service=WebServer" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.web:service=WebServer' **

Lire la suite