Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
Highlighted
Jackson11 Absent Member.
Absent Member.
2174 views

itadmin shell script issue

Hi All,

I am facing issue when executing itadmin process list -a | grep XYX from a shell script .

The below script snippet is returning blank value " " even when the service is up and running.

PROCESS=`itadmin process list -a | grep XYZ`
if [ "${PROCESS}" == "" ]
then
echolog "Service is down"
exit 1
fi

But when I run the same command directly from windows command line I get the expected return value ie XYZ

itadmin process list -a | grep XYZ

 XYZ.

Not sure why it is failing when called from shell script. 

Thanks in advance.

Tags (1)
0 Likes
4 Replies
Jackson11 Absent Member.
Absent Member.

RE: itadmin shell script issue

This is on 64-bit windows machine provided with a unix like environment for scripting.

0 Likes
Micro Focus Contributor
Micro Focus Contributor

RE: itadmin shell script issue

grep isn't installed by default on Windows by default. Are you running in Cygwin or something like that? Are you sure this question relates to Orbix though? For example if you replaced 'itadmin process list -a' with 'echo XYZ' would you see the same results?

Also, it's worth noting that itadmin is a TCL parser, so you could achieve the same results in TCL. Here is a simple TCL script that would do this, you can copy this and save it as simple.tcl

if {$argc > 0} {

set active [process list -a]

if [regexp -- $argv $active] {

puts stdout "$argv running"

} else {

puts stdout "$argv not running"

}

} else {

puts stderr "This is a simple application to check if a process is running"

puts stderr "Usage:"

puts stderr "itadmin simple.tcl <process name>"

}

If I run this in an environment where I have the naming service running here is the output:

itadmin simple.tcl

This is a simple application to check if a process is running

Usage:

itadmin simple.tcl <process name>

itadmin process list -a

iona_services.naming.DUB-JURISL

itadmin simple.tcl naming

naming running

itadmin simple.tcl XYZ

XYZ not running

Tags (1)
0 Likes
Jackson11 Absent Member.
Absent Member.

RE: itadmin shell script issue

Hi Martin,

Thanks a lot for the quick response. Yes I am using a software package like cygwin  that provides a Unix-like environment for scripting. And grep commands works totally fine as I am able to get the running service when I directly execute "itadmin process list -a | grep XYZ" .

The shell script was working fine for few months and suddenly it stopped working. To resolve this problem  I am calling a perl script (test.pl) from shell : and test.pl calls itadmin process list -a internally.

PROCESS=`D:/software/perl-5.8.4/bin/perl.exe test.pl | grep XYZ`

echo "PROCESS : $PROCESS" returns PROCESS : XYZ

Is there a possibility that it may be linked to server node cluster configuration?

I still don't understand when itadmin process list -a | grep XYZ works fine when executed directly from command line and fails when executed from shell script.

In the mean time I will modify the shell do call tcl script and see if it is able to catch the correct running service.

Many thanks

Jackson

0 Likes
Jackson11 Absent Member.
Absent Member.

RE: itadmin shell script issue

Hi,

I debugged the shell script using set -x and

PROCESS=`itadmin process list -a | grep XYZ` is working fine when I give the full path for itadmin exe ie

PROCESS= `FULLPATH\itadmin.exe process list -a | grep XYZ` > This has resolved the problem.

Just before this script stopped working we switched between 2 server nodes not sure if this has caused this problem.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.