Archive for May, 2007

Enabling ACL supoprt on Tru64 (OSF)

Wednesday, May 23rd, 2007

ACL processing is enabled and disabled dynamically using the sysconfig utility or the secconfig menu. To enable ACL processing dynamically using the sysconfig command, enter the following:

# sysconfig -r sec acl_mode=enable

To disable ACL processing dynamically using the sysconfig command, enter the following:

# sysconfig -r sec acl_mode=disable

To view the current ACL processing mode using the sysconfig command, enter the following:

# sysconfig -q sec

To have ACLs enabled automatically as part of system startup, create a stanza file containing the ACL mode enable entry, for example:

sec:
acl_mode = enable

Then use sysconfigdb to add it to the /etc/sysconfigtab file:

# sysconfigdb -m -f acl_mode.stanza sec

On subsequent reboots, ACL processing is enabled automatically.

Source: http://h30097.www3.hp.com/docs/…

Bad luck

Wednesday, May 16th, 2007

Last week we were scheduled to have a siding replacement on our ranch house. Unfortunately contractor call and tell us that the siding we choose is not available at warehouse while the computer system indicates otherwise. So we have to wait another week till it gets here.

Well, next week (today), I got to know that delivery for a double sink for our bathroom will be delayed too. And the reason for this, (more…)

Compiling on SuSE 10+ (glibc detected invalid pointer during free)

Tuesday, May 15th, 2007

I was trying compile code on SuSE 10.1 and get following error:

*** glibc detected *** free(): invalid pointer: 0×081c80f0 ***

The solution to move forward is to disable a new feature of GLIBC to verify pointers before free the memory. There is an environment variable MALLOC_CHECK_ that has following recognizable values:

0 — Do not generate an error message, and do not kill the program
1 — Generate an error message, but do not kill the program
2 — Do not generate an error message, but kill the program
3 — Generate an error message and kill the program

[Source]

Calling SOAP API from UNIX Shell

Monday, May 14th, 2007

Sometime a UNIX shell is a best choice to have a quick clean solution. However sometimes it is luck the flexibility and APIs to work with latest technologies.

Recently I was asked to write a small UNIX application and one of the requirements was to update MS SQL database table with status value. i didn’t want to install additional packages on UNIX server to achieve direct access to MS SQL server, but rather to use a minimal tools.

I decided to use SOAP as a transport layer between UNIX and MS SQL server. On UNIX machine I install wget. Make sure you install wget with at least version 1.10.2!!!

On Windows machine I create a simple Web Service application using ASP.NET that will access the database using native driver.

Now, to send a request I will create an XML file with SOAP envelop:

cat > $RQXML <<End
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <SetStatus xmlns="http://domain.com/">
      <FormID>${FORM_ID}</FormID>
      <Status>${ITEM}</Status>
    </SetStatus>
  </soap12:Body>
</soap12:Envelope>
End

Then we will send request to web service using wget:

if ! /usr/local/bin/wget -q -O $OUTPUT --post-file=$RQXML
       --header="Content-Type: text/xml; charset=utf-8" ${URL}
then
  # failre here
  return 0
fi

The important part of this line is —-header=”Content-Type: text/xml; charset=utf-8″. It will indicate that the stream is an XML data. The reply from server will be stored into ${OUTPUT} which you can parse later for results.

Writing multi-process application in UNIX-Shell

Monday, May 14th, 2007

Sometimes you need to improve performance of an application where UNIX shell script need to start a several process. The solution below can help you if application logic allows to run them in parallel, and application will not advance to the next step till all started processes are finished.

The solution have two parts. First part is to start processes simultaneously:

totalProc=4
idx=0

while [[ $idx -lt $totalProc ]]
do
  # will wait for each OS
  if [[ ${CHILDS[$idx]} -gt 2 ]]
  then
    # starting child process
    ${executable name} 2>&1 > ${logname}.log &
    CHILDS[$idx]=$!
  fi
  idx=$(( $idx + 1 ))
done

Next step is to wait till child processes are finished:

idx=0
while [[ $idx -lt $totalProc ]]
do
  # will wait for each OS
  if [[ ${CHILDS[$idx]} -gt 2 ]]
  then
    echo "===================== waiting for ${CHILDS[$idx]}"
    PID=${CHILDS[$idx]}
    wait $PID
    CHILDS[$idx]=$?
    if [[ ${CHILDS[$idx]} -ne 0 ]]
    then
      # process failed
    else
      # process finished
    fi
  fi
  idx=$((idx+1))
done

This script will wait for all children processes one by one in order they were created.