cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
benhong_li
Level 2

Execute Script/Batch file: stuck

Hi,

I'm trying to wrap a RMI server application as service, which will check the RMI server exit code and restart it under certain conditions.

Everything works perfect if I setup the service through command line. When I tried it through Execute Script/Batch file in IA 2008, it also worked perfect on Solaris. But it got stuck on Red Hat Enterprise 5.6.

The script I tried to run via IA is as follows:

if [ `uname | grep -i Linux` > /dev/null ]; then
/bin/bash -c "service swdagent start&"
else
svcadm enable swdagent
fi

The service setup script is like the following:

# /etc/init.d/ script
start_agent()
{
errCode=1
while [ "$errCode" -ne 0 ]; do
$JAVA_EXEC $J_OPTS com.swd.rmi.SwdAgent agent_status
if [ "$?" -ne 0 ]; then
echo "The swd agent is already running."
errCode=0
echo
else
echo "Starting swd agent"
nohup \
$JAVA_EXEC $J_OPTS com.swd.rmi.SwdAgent > /dev/null 2>&1
errCode=$?
if [ "$errCode" -eq 5 ]; then
errCode=0
echo "Failed to bind RMI Service"
fi
fi
done
}


# main
......
case "$1" in
start)
echo
start_agent &
echo
;;
.......

The behavior is same if I enable service through java Runtime.exec() - worked perfect on Solaris and stuck on RHEL.

Any expert there can shed some light n how to get around this?

Thanks a lot,
Ben
Labels (1)
0 Kudos
(3) Replies
pv7721
Level 20

Have you tried to manually run the script on RH5.6, of course, with the IA variables replaced?
0 Kudos
benhong_li
Level 2

It works fine if run from command line.

If installanywhere users java Runtime to execute the script, then I believe it's the java Runtime issue. When I run the script directly through java Rumtime, it's also stuck.

Using java Runtime to execute script/batch file is OS-dependent, that explains why it succeeded on Soalris, but stuck on Linux.
0 Kudos
pv7721
Level 20

This script, do you run it verbatim (as is) inside InstallAnywhere?
0 Kudos