Command Line Argument Relevance Help

I am trying to write ‘success criteria’ relevance for a number of tasks we use to stop/start an application running on a Unix server in my environemnt… to validate whether or not it is running (after we stop/start the app). Just a true/false output via the relevance:

exists processes whose (command line argument of it contains "xxx")

OR:

not exists processes whose (command line argument of it contains "xxx")

I need a portion of the following output to indicate the application is running (or not)…particularly where it states “/wM97AMR/IntegrationServer” as the “wM97” part of this CLI argument indicates one of many different processes.

Required grep for one of the several processes is as follows:

ps -ef | grep AMR/Int

wmpadm 37027978 38142104 4 Mar 18 - 1131:03 /wmp/webMethods/wM97/wM97AMR/jvm/jvm/bin/java -Dosgi.install.area=/wmp/webMethods/wM97/wM97AMR/profiles/IS_default -Declipse.ignoreApp=true -Dosgi.noShutdown=true -XX:MaxPermSize=256M -Xbootclasspath/a:/wmp/webMethods/wM97/wM97AMR/common/runtime/agent/repository/plugins/com.softwareag.platform.jaas.proxy_9.7.0.0000-0400.jar -Djava.io.tmpdir=/wmp/webMethods/wM97/wM97AMR/profiles/IS_default/workspace/temp -server -Dorg.apache.xml.dtm.DTMManager=org.apache.xml.dtm.ref.DTMManagerDefault -Djavax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom=com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl -Dcom.webmethods.sc.auditing.Use80TableFormat=true -Dsun.lang.ClassLoader.allowArraySyntax=true -DWM_HOME=/wmp/webMethods/wM97/wM97AMR -Dwatt.server.prepend.classes=/wmp/webMethods/wM97/wM97AMR/common/lib/wm-converters.jar -Dwatt.server.append.classes= -Xbootclasspath/p:/wmp/webMethods/wM97/wM97AMR/IntegrationServer/instances/../../common/lib/ext/serializer.jar:/wmp/webMethods/wM97/wM97AMR/IntegrationServer/instances/../../common/lib/ext/xalan.jar:/wmp/webMethods/wM97/wM97AMR/IntegrationServer/instances/../../common/lib/ext/xercesImpl.jar:/wmp/webMethods/wM97/wM97AMR/IntegrationServer/instances/../../common/lib/ext/xml-apis.jar -Xverbosegclog:./logs/gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-PrintTenuringDistribution -XX:+PrintGCDateStamps -Xms5632m -Xmx5632m -Djava.library.path=/wmp/webMethods/wM97/wM97AMR/common/lib/tw-3.5.25:/wmp/webMethods/wM97/wM97AMR/common/lib:/wmp/webMethods/wM97/wM97AMR/common/security/ssx/lib:/wmp/webMethods/wM97/wM97AMR/IntegrationServer/instances/default/lib -classpath /wmp/webMethods/wM97/wM97AMR/common/lib/tw-3.5.25/wrapper.jar:/wmp/webMethods/wM97/wM97AMR/common/runtime/agent/repository/plugins/com.softwareag.platform.bootstrap_9.7.0.0000-0400.jar:/wmp/webMethods/wM97/wM97AMR/common/runtime/agent/repository/plugins/org.eclipse.equinox.launcher_1.3.0.0000-0005.jar -Dwrapper.key=wPeZdqvuuXKMAd0iGJo0xuVGgL7f9gqJ -Dwrapper.port=32006 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.disable_console_input=TRUE -Dwrapper.pid=38142104 -Dwrapper.version=3.5.25-st -Dwrapper.native_library=wrapper -Dwrapper.arch=ppc -Dwrapper.ignore_signals=TRUE -Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1 -Dwrapper.lang.domain=wrapper -Dwrapper.lang.folder=../lang org.tanukisoftware.wrapper.WrapperStartStopApp org.eclipse.equinox.launcher.Main 4 -configuration /wmp/webMethods/wM97/wM97AMR/profiles/IS_default/configuration -service sagis97 com.softwareag.osgi.Bootstrap FALSE 2 remote_shutdown localhost:8045
$

I have tested various iterations of relevance to pull what I am looking for and I can’t seem to get it and the CLI argument piece is getting cut off, resulting in the relevance not working/finding what I am looking for:

Q: (pid of it, name of it, command line arguments of it) of processes whose (command line argument of it contains "Integration")
T: 21887

Q: (pid of it, name of it, command line arguments of it) of processes whose (command line argument of it contains "wM97AMR")
T: 25689


Q: (pid of it, name of it, command line arguments of it) of processes whose (command line argument of it contains "webMethods")
A: 17039546, wrapper-3.5.25, /wmp/webMethods/wM97/
A: 17956994, wrapper-3.5.25, /wmp/webMethods/wM97/
A: 31785002, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 32964678, wrapper-3.5.25, /wmp/webMethods/wM97/wM97
A: 33161218, wrapper-3.5.25, /wmp/webMethods/wM97/wM97
A: 33292420, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 33816694, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 33947676, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 34406454, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 34472020, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 34799706, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 35127428, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 36110422, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 36765832, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 38142104, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 38535358, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 38797486, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 38928386, wrapper-3.5.25, /wmp/webMethods/wM97/wM9
A: 40435940, wrapper-3.5.25, /wmp/webMethods/wM97/
T: 21902

Curious if anyone has any experience with a situation like this and any suggestions on another relevance statement to use?

Thanks!

So the issue is you aren’t getting as many results as you wish?

Does this help?

(pid of it | 0, name of it | "", command line arguments of it) of processes whose (command line argument of it contains "webMethods")

If I’m reading the original post correctly, it looks like the command line arguments of <process> property is being truncated when there is a very long command line argument.

1 Like

Is this useful? :

pathnames of image files of processes

As a workaround, you could change the Success Criteria to “all lines of the script execute successfully”, and put a check in the action itself to fail.

Something like

wait /bin/sh -c "ps -ef | grep AMR/Int >/tmp/process_check.out"

continue if {exists lines containing "/wM97AMR/IntegrationServer" of files "/tmp/process_check.out"}
1 Like

Hi guys…thanks for the responses…reviewing now. Will get back shortly.

Hi All,

@jgstew That still truncates the information I am looking for. As for the ‘pathnames’…I will play with that too.

@Jason I will have to test that code in my action and see if that works. Ideally I’d like to keep the shell scripting in my actions as simple as possible…hence using the success criteria…which appears not to be able to pull what we’re looking for.

Still trying here. :slight_smile:

Also, try this:

command line arguments of processes

And this:

(multiplicity of it, it) of unique values of command line arguments of processes

See what doing that and nothing else gives you… it might have more info than you think. It is very useful to look at the data in the rawest form to start with.

The other thing to look at is it might be truncating due to odd characters in the arguments that are tripping it up, there are some ways around that too.

1 Like

Still showing a truncated process string. Must have to do with the full string being screwy (as shown in post #1).

“/wmp/webMethods/wM97/wM9”

Same deal with the second suggestion too.

A: 3, /wmp/webMethods/wM97/
A: 15, /wmp/webMethods/wM97/wM9

I wonder if I need to try what you suggested with pathnames and whatnot. But definitely need the success criteria to be checking for the running processes. (will continue to hammer this out).

1 Like

If you only need this for success criteria and not for applicability, then that makes it much more feasible to just dump out data to /tmp using a command and use that to check for success with relevance by reading the file created.

Thanks! Will likely start working on this particular plan this week and will work to go just that if it isn’t going to play nice otherwise.

I suspect that the size of (some) properties may be limited in size… did you check if the lengths of the returned property “command line argument” have some sort of capping?

  • maximum of (length of concatenations " " of command line arguments of it) of processes

Does relevance have a faux-shell that it uses for some of these things? Perhaps that faux-shell has a line limit? (I know I often find that some things work better if I dump to shell; instead of wait foo, wait /bin/bash -l -c “foo”)

IIRC ps by default truncated to the shell window’s line length. If you use -ww (“wewwy wide”) or (in more contemporary OSes) -ef then you get the full line length, with wrapping.