Archive April 2013

jrebel/eclipse/remote jbossAS server step by step


April 19, 2013

install jrebel with eclipse:
– get licence from jrebel web site
– install jrebel eclipse plugin. Restart eclipse and activate you licence
– in jrebel config center : select one projet in projects panel, and enter in corresponding “deployment URL” field your jboss7 server url (example http://myserver:8080)
   you will have “Server responded with an error: null”, don’t worry, this because server was not yet configured to respond to remote requests
– now compile and package your project and then put it in your server jboss.

install jrebel under jboss7
– copy “C:UsersYOURHOME.jrebeljrebel.lic” et “C:UsersYOURHOME.jrebeljrebel.properties” to the home of your server user launching jboss : /home/user_launchig_jboss/.jrebel/
– get jrebel.jar from jrebel web site and put it in your host machine
– add following in the script launching jboss7 before call standalone.sh :
export JAVA_OPTS=”$JAVA_OPTS -javaagent:/path/to/jrebel.jar -Drebel.log.file=$JBOSS_HOME/standalone/log/jrebel.log -Drebel.remoting_plugin=true”
– start server jboss7
=============================
if you have following error : Server responded with an error: null ==> this because remoting is not enabled in jrebel java agent : add  -Drebel.remoting_plugin=true in java_opts
if you have following error : Server responded with an error: Remoting module’navco-module-delegal-postes-pm’ was not found ==> redeploy your project in jboss7 (jrebel remoting needs the rebel-remote.xml)

be notified of all svn changes

If you want like me have been notified of all svn changes, the following script I wrote for you.

Prerequisite :

  • svn installed
  • svn well configured for user executing script

#!/bin/bash

export SVN_UPDATES_HOME=/mnt/scripts/svnUpdates
export SVN_UPDATES_LAST=$SVN_UPDATES_HOME/tmp/svnUpdatesLast.txt
export SVN_UPDATES_TMP=$SVN_UPDATES_HOME/tmp/svnUpdates.txt
export SVN_UPDATES_DIFF_TMP=$SVN_UPDATES_HOME/tmp/svnUpdatesDiff.txt
export SVN_UPDATES_DIFF_LOG=$SVN_UPDATES_HOME/log/svnUpdatesLog

if [[ -s $SVN_UPDATES_LAST ]]
then
  echo “copy last svn log to tmp”
  cp $SVN_UPDATES_LAST $SVN_UPDATES_TMP
else
  touch $SVN_UPDATES_TMP
fi

for log in 1 2 3
do
  echo “svn log – try:$log”
  svn log -v -l5 -rHEAD:1 https://svn.witr.net > $SVN_UPDATES_LAST
  if [[ -s $SVN_UPDATES_LAST ]]
  then
    echo “svn logged successfully in try:$log”
    break
  fi
done

if [[ -s $SVN_UPDATES_LAST ]]
then
  echo “proceed to diff last with tmp”
  diff $SVN_UPDATES_LAST $SVN_UPDATES_TMP | grep -E “^ $SVN_UPDATES_DIFF_TMP
  diffsCount=$(wc -l $SVN_UPDATES_DIFF_TMP | awk {‘print $1’})
  if [ $diffsCount -gt 0 ]
  then
      “diffs found: send notification”
      datetime=$(date “+%Y%m%d-%H%M%S”)
      logFile=$SVN_UPDATES_DIFF_LOG$datetime
      cp $SVN_UPDATES_DIFF_TMP $logFile
      ### put here the way you want be notified (mail, jabber, …)
      ### echo “==== svn updated cf. $logFile ====” | sendxmpp mabrouk@openfire.witr.net
      ### cat $logFile | sendxmpp mabrouk@openfire.witr.net
  fi
fi

Here I choose to be notified by message sent from jabber server from my account to my account.
Prerequisite : sendxmpp installed : apt-get install sendxmpp

echo “==== svn updated cf. $logFile ====” | sendxmpp mabrouk@openfire.witr.net
cat $logFile | sendxmpp mabrouk@openfire.witr.net

Finally, schedule the script in your crontab (executed each minute recommanded)

* * * * * /mnt/scripts/svnUpdates/svnUpdates.sh

mount cifs windows drive under ubuntu

April 18, 2013

monter un drive cifs windows:
> mount -t cifs -o rw,username=mba,password=xxxxxx //drive/users /drive/U
j’ai eu ce message d’erreur
mount : mauvais type de système de fichiers, option erronée, superbloc
        erroné sur //drive/users, page de code ou aide manquante, ou autre erreur
       (pour plusieurs syst. de fichiers (nfs, cifs) vous pouvez avoir
       besoin d’un programme /sbin/mount. intermédiaire)
       Dans quelques cas certaines informations sont utiles dans syslog – essayez
       dmesg | tail  ou quelque chose du genre

j’ai regardé dans dmesg
> dmesg | tail
j’ai eu:
[75756.500633] CIFS VFS: cifs_mount failed w/return code = -22

il suffit d’installer cifs-utils pour que le problème soit réglé
> sudo apt-get install cifs-utils

apache2+php


April 12, 2013

apache2+php
> sudo apt-get install apache2
> sudo apt-get install php5
> sudo apt-get install libapache2-mod-php5
> sudo /etc/init.d/apache2 restart
> vi /etc/apache2/sites-available/default : modifier /var/www by your prefered folder

move /usr to have more disk space


April 11, 2013

soit votre vm “ubuntu”
– sudo gparted
– deux possibilités:
  1- créer une partiotion ext4 s’il y a un espace non partitionné sur le disque
  2- démonter la partition qu’on va redimensionner + redimensionner + créer sur la nouvelle partie non partitionné une partition ext4
– sudo mkdir /media/myusr
– sudo mount /dev/sdax /mnt/myusr
– sudo blkid
…………
/dev/sdax: UUID=”xxxx-xxx-xxx”
…………..
– ajouter cette ligne dans /etc/fstab :
UUID=xxxx-xxx-xxx /media/myusr ext4 errors=remount-ro  0     1
– sudo cp -a /usr/. /media/myusr/

arrêter ubuntu.
crééer une nouvelle vm “tmp” avec un nouveau disk virtuel + y attacher le disk de la vm ubuntu
et démarrer la nouvelle vm tmp
– sudo blkid
…………
/dev/sdax: UUID=”yyyy-yyy-yyy”
…………..
/dev/sdbx: UUID=”xxxx-xxx-xxx”
…………..
– mkdir /dev/sdbx /media/sdbroot
où sdbx est la partition boot de ubuntu qui contient /usr
– sudo mount /dev/sbdx /media/sdbroot
– sudo rm -rf /media/sdbroot/usr/*
– vi /media/sdbroot/etc/fstab
– modifier cette ligne dans /etc/fstab :
UUID=xxxx-xxx-xxx /media/myusr ext4 errors=remount-ro  0     1
remplacer /media/myusr par /usr
UUID=xxxx-xxx-xxx /usr ext4 errors=remount-ro  0     1
– sudo umount /dev/sbdx
– arrêter la vm tmp + supprimer là si vous voules (on en a plus besoin)
– démarrer la vm ubuntu et le /usr est bine déplacé sur la nouvelle partition !

sendxmpp : send jabber message with command line


April 8, 2013

sendxmpp : send jabber message with command line:
install sendxmpp (https://www.ebower.com/docs/ubuntu-scripted-gtalk/) : > sudo apt-get install sendxmpp
create user config file : > touch ~/.sendxmpprc
secure your configuration file :  > chmod 600 ~/.sendxmpprc
configure jabber account : > echo ‘myusername@gmail.com;talk.google.com mypassword’ > ~/.sendxmpprc
send your first message : > exho “salut” | sendxmpp yourFriend@server