Command Lines and Process Names
I can’t use a quoted string as a command argument in UNIX.
On UNIX, quoted strings with embedded blanks cannot be passed as command arguments to UNIX shell scripts by means of the Custom::execute
, Custom::executeForNumber
and Custom::executeForString
methods. The Java Virtual Machine (JVM) parses these strings as blank delimited tokens and passes them as separate arguments.
To work around this, utilize a shell script as the executable. Pass all arguments that do not contain spaces first. Then use the "shift" shell command and a wildcard argument variable, "$*", to pass the space containing argument at the end.
I'm trying to execute a command line using custom: execute, and it won't work -- but when I shorten the command line it works. What should I do?
This is a known problem because some operating system shells limit the size of command lines that can be passed to them. To get around this problem, write a script with the long command line, and call that script from the custom:execute
method.
Platform: Not Specified
Version: All
Why can't I match long process names?
When using the process:getProcess
method (UNIX) or performance: ProcessCount method
(Microsoft Windows), you may find that process names longer than a certain length cannot be matched exactly. This limit on process names comes from the operating system functions used to collect this information.
There are several workarounds to the limitation of process names:
• | Only specify process names that are less than 14 characters. |
• | Use regular expressions to match process names. For example, to find process abcdefghijklmn you might search for the regular expression abcdef.* . |
• | Invoke the Process::getProcess method with no arguments to view the supported process name length. |
• | Use the Process::getIntancesByCommand method to match on the process's Command string. |
• | Use the Process microagent. |
The full command is not returned by my operating system. What do I do?
In the Process::getProcess
and Process::getInstanceCountbyCommand
methods, the full command may not be returned. The command is truncated to between 55 and 80 characters, depending upon the operating system, and contains the same information as the ps -ef
utility. To get the full command, use a script that utilizes the UCB ps
utility (for example, /usr/ucb/ps -auxww | grep -c mycommand
) in conjunction with Custom::executeForNumber()
.