Thursday, September 22, 2011

Add an Apache2 virtual host in Ubuntu

Add the following file into /etc/apache2/sites-available
fart:
<VirtualHost *:80>
    ServerAdmin jerome.gallinari@gmail.com
    ServerName fart.ulticom.com

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>


Activate the vhost: this creates a symlink from sites-enabled to sites-available
sudo a2ensite fart
Activate the new configuration
sudo /etc/init.d/apache2 reload

Make a correspondance between the new vhost and the local host
/etc/hosts:
127.0.0.1 localhost fart

Wednesday, September 21, 2011

Cannot access QNAP administration page

Symptoms: Accessing to the QNAP web administration page (http://192.168.1.102:8080) gives a blank page. Curiously, this does not happen with IE9 or Chrome, but only with Firefox 6 and does not concern access via https.

Solution: This is related to the filtering of web pages by Eset NOD32 v5.
To fix this:

NOD32 Setup | Web access protection | Configure
Web and email | Web access protection | Protocol filtering | Excluded IP addresses
and add address 192.168.1.102

Monday, September 5, 2011

How to access a guest Ubuntu web server installed in VirtualBox from a Windows 7 host OS

1) Reserve the IP address of the VirtualBox VM in the router DNS, e.g. 192.168.1.103

2) In C:\windows\system32\drivers\etc\hosts, add
192.168.1.103 fart.ulticom.com Then http://fart.ulticom.com on W7 will match the root document of the Apache web server on Ubuntu.

Thursday, August 4, 2011

Configure ATM on a PH301

First find SN#.

liasse> linkupgrade
Boards found in CE liasse :
Board 0, Ulticom 0200 type, sn# 22138, with 16 links , revision 2H
Board 0, Ulticom 0301 type, sn# 45877, with 2 links , line interface type ATM ,revision B1

Then upgrade the EEPROM on the board:

/export/home/omni_9S6/bin/test/makekey 45877 2 -b 0301 -i ATM -mode nonchan

Then restart SW and the board will be flashed.

Generate a new license file

Prendre un fichier existant: ULCM_Signalware_9_license.lic.
Rajouter/remplacer une machine.

/export/home/omni/bin/generateUlticomHostId

Reporter dans le fichier.

 cp ~/bin/scripts/resign/keystore .
 /u/gallinar/bin/scripts/resign/resign ULCM_Signalware_9_license.lic
 licenseUpdate -name Signalware -ver 9

Change php.ini on yapita

ssh yapi
su -
pwd=license4
~licweb/bin/me /etc/opt/apache/php.ini
/opt/apache/sbin/apachectl stop
/opt/apache/sbin/apachectl start

See full license My SQL req / rsp

ssh yapi
~licweb/bin/me /export/licweb/htdocs/lfgweb/conf.inc

Change ‘CONF_LOG_TRACE_LEVEL’ from ‘INFO’ into ‘ALL’.

tail -f /export/licweb/htdocs/lfgweb/log/dbproxy.<day>.log

Downgrade the license of a board

Downgrading board 0 to 2 links on king:

[gallinar@king] gallinar_cr32561_sun 698 > linkupgrade
Boards found in CE king :
Board 0, Ulticom 0200 type, sn# 23550, with 16 links , revision 4J
Board 1, Ulticom 0200 type, sn# 23507, with 16 links , revision 4J

[gallinar@king] gallinar_cr32561_sun 698 > /vob/signalware/Master/linkupgrade/unit_test/makekey 23550 2 -b PC0200 -i TDM -mode nonchan
crc=0x9EA64CF3
23550-ztkfbbfc-pwqhetyd

[gallinar@king] gallinar_cr32561_sun 698 > linkupgrade 23550-ztkfbbfc-pwqhetyd
no duplicate boards found
Upgrading board sn# 23550
Verifying board sn# 23550
Board sn# 23550 on king has been downgraded to 2 links

[gallinar@king] gallinar_cr32561_sun 698 > linkupgrade 
Boards found in CE king :
Board 0, Ulticom 0200 type, sn# 23550, with 2 links , revision 4J
Board 1, Ulticom 0200 type, sn# 23507, with 16 links , revision 4J

licenseUpdate

Can be done without stopping the stack (dyn.).

yapita / yapitatest information

Symbolic links:

/export/licweb/htdocs -> /export/apache/lfg/htdocs
/export/apache -> /export/homea/apache

phpMy Admin directory:

/export/homea/apache/yapitatest/htdocs/phpmyadmin

There is now a symlink from ~licweb/phpmyadmin to access it via: http://yapitatest.ulticom.com/phpmyadmin
To make it work, I had to change the owner of the phpmyadmin directory as well as the phpmyadmin/index.php to be (licweb, apache).

Document Root is defined as /export/homea/apache/lfg/htdocs in:

/etc/opt/apache/hosts/lfgtest.conf

Connect from xenon to yapitatest

xenon> mysql -u lfguser2 -pzolefogo -h yapitatest.ulticom.com lrsdb2

How to test a new hostid

From CR29335:

  • I changed temporarily the machine hostid to be the same as the Petra’s machine (siena2): 0×05919040. Actually, I just wanted to test the license lib against a hostid starting with 0.
  • I then re-generated the complete Ulticom host id of the machine and used it to re-sign my license file.
    This caused licenseUpdate to output the same original error message as Petra’s: “Permission denied, no valid Ulticom host identifier.”
  • I then used gdb to track what part of the code in the license lib was causing it.
    From what I saw, in expatparse.c file, function processHost Id(), we try to compare the string “05919040-Sun OS-sangria-E04CA67B1B5BBABBB83726A8”, as extracted from my license file with either “5919040-Sun OS-33BEB694D320A3A018243C2B9C” or “5919040-Sun OS-sangria-2918BA5D70D5EEA84E90339FB6”, which are the results of getMy Host Id From CE() and getMy Old Host Id From CE() respectively.

How to use deploy.xml onto lrsbet2

> /vob/common/3rdparty/jakarta-ant/apache-ant-1.8.1/bin/ant -f deploy.xml -Dlrs.instance=test2

gprof enabling

  • Add the ”-pg” option to every .o compilation + to the exe also.
  • Link with static versions of libraries that need being profiled.

Example given:

cd /vob/signalware/Master/scos
swmake gprof
cd /vob/signalware/Master/test/tcap/c7
rm /vob/signalware/Master/library/libscos.so
clearmake -V "PROT_FLAGS=-DC7_Q" gprof

Then running c7icptrans should produce a gmon.out.

To extract the information from gmon.out, use gprof:

gprof /export/home/omni_9S5/bin/test/c7icptrans gmon.out > gprof.txt

Tuesday, July 19, 2011

ARRAY

- definisce un array
    set -A Week Sat Sun Mon Tue Wed Thu Fri
- ritorna un elemento dell'array
    echo ${Week[3]}                            .. Tue
    id=3 ; echo ${Week[id]}                    .. Tue
- stampa tutti gli elemti di un array
    echo ${Week[@]}                            .. Sat Sun Mon Tue Wed Thu Fri
- scandisce un array
    for day in ${Week[@]}
    do
        echo $day
    done
- ritorna il numero di elementi in un array
    nelem=${#Week[@]} ; echo $nelem            .. 7

REGULAR EXPRESSION

- ritorna la prima lettera dopo il segno - all'inizio di una stringa
    VAR="-ciao" 
    RESULT=`expr "$VAR" : "-\(.\)"`
    echo $RESULT        .. -c
- toglie il '-' iniziale
    VAR="-ciao" 
    VAR=`expr "$VAR" : "-*\(.*\)"`
    echo $VAR           .. ciao
- ritorna la lunghezza di una stringa
    VAR="ciao" 
    echo `expr length $SHELL`      .. 4
- ritorna l'indice di dove incontra una substringa
    echo `expr index abcdef de`    .. 4
- ritorna 6 caratteri a partire dall'11
    expr substr "Goodnight Ladies" 11 6     .. Ladies

EXAMPLES

- Explode a command for use parameters counter
    set `who -r` ; [ "$8" != "0" ] && exit

- declare a variable for only uppercase/lovercase chars
    typeset -u VAR ; VAR="lower" ; echo $VAR   -> LOWER
    typeset -l VAR ; VAR="UPPER" ; echo $VAR   -> upper

- exec

- eval - esegue il comando dato come argomento

- let - esegue le operazioni matematiche che passate come argomento
    let "x = x * 5" 
    ((x = x * 5))        .. altra forma di let

COPROCESS

La ksh permette di lanciare uno o piu' comandi come processi in background.
Questi processi sono chiamati coprocesses e sono utilizzati per comunicare
con un programma.
Un coprocess si crea mettendo l'operatore |& (pipe, ampersand) dopo un commando.
Entrambi stdin e stdout del commando sono piped verso il tuo script.
Un coprocess deve incontrare le seguenti restrizioni:
·    Includi un new-line alla fine di ogni messaggio
·    Manda ogni messaggio di output allo standard output
·    Pulisce il suo stdout dopo ogni messaggio

L' esempio dimostra come l'input e' passato verso e ritornato da un coprocess:
  echo "Initial process" 
  ./FileB.sh |&
  read -p a b c d
  echo "Read from coprocess: $a $b $c $d" 
  print -p "Passed to the coprocess" 
  read -p a b c d
  echo "Passed back from coprocess: $a $b $c $d" 
FileB.sh
  echo "The coprocess is running" 
  read a b c d
  echo $a $b $c $d
L'output risultante e' il seguente:
  Initial process
  Read from coprocess: The coprocess is running
  Passed back from coprocess: Passed to the coprocess

Il comando 'print -p' ti permette discrivere verso il coprocess.
Per leggere dal coprocess, lancia il comando 'read -p'.

OTHER FUNCTIONALITIES

cmd1 || cmd2    exec cmd2 if cmd1 fail
cmd1 && cmd2    exec cmd2 if cmd1 is OK

V1=${V2:=V3}    Set V1 with the value of V2 if this is set else set the
                variable V1 with value of V3 (V3 could be a number).
                sh replacement:  if [ $V2 ] ; then
                                                V1=$V2
                                 else
                                                V1=$V3
                Example: DisplaySize=${LINES:24} ; Command=${Command:"cat"}

${V1:?word}     if V1 set  & V1!=null   ret $V1 else print word and exit
                  : ${V1:?"variable V1 not set on null"}
${V1:=word}     if V1 !set | V1==null   set V1=$word
${V1:-word}     if V1 set  & V1!=null   ret $V1 else ret word
${V1:+word}     if V1 set  & V1!=null   ret word else ret nothing
${V1##patt}
${V1#patt}      if patt are found at the begin of V1 return V1 whitout the patt
                else return V1
                V1="lspwd" ; ${V1#"ls"}  # exec pwd
${V1%%patt}
${V1%patt}      if patt are found at the end of V1 return V1 whitout the patt
                else return V1
                V1="lspwd" ; ${V1%"pwd"}  # exec ls

REDIRECTIONS

0             stdin
1             stdout
2             stderr

<&-           close stdin
>&-           close stdout
<>filename    open filename for read-write
2>&1          open 2 for write and dup as 1

Examples:
  cmd 2>/dev/null
  cmd >/dev/null 2>&1
  exec 1<&-           # close descriptor 1
  exec 2<&-           # close descriptor 2
  exec 1< /dev/null   # open descriptor 1
  exec 2< /dev/null   # open descriptor 2