

Knowing the PID allows you to kill a malfunctioning process Usually, when running the ps command, the most important information the user is looking for is the process PID. The four columns are labeled PID, TTY, TIME, and CMD. The output includes information about the shell ( bash) and the process running in this shell ( ps, the command that you typed): PID TTY TIME CMD In it’s simplest form, when used without any option, ps will print four columns of information for minimum two processes running in the current shell, the shell itself, and the processes that run in the shell when the command was invoked. GNU long options, preceded by two dashes.ĭifferent option types can be mixed, but in some particular cases, conflicts can appear, so it is best to stick with one option type.BSD style options, used without a dash.UNIX style options, preceded by a single dash.We can fine tune the script later on like passing process name as an argument to make it reusable etc.īut for now try it out and let me know if this works.For historical and compatibility reasons, the ps command accepts several different types of options: I would have made some rookie mistakes try out the above steps and let me know if it works If you want to set the threshold that is based on your processcount. PROCESSCOUNT=`ps -ef | grep -i XYZ | wc -l`Įcho "Statistic.processcount: $ PROCESSCOUNT" Įcho "Message.processcount: Process XYZ Instance count $PROCESSCOUNT" Ħ. Script body -> Click on EDIT SCRIPT and provide the below commands (you are trying to get a process count of a certain process isnt it, lets say process name is XYZ for example) You will see 'Script working directory' just mention /tmp (its ideally /tmp as it executes on the end device and I dont want to store it elsewhere, but upto you, you can provide any feasible directory that you want.)Ĥ.

Create a new Linux/Unix Script component monitor on an example template/application.Ģ. Its been quite some time that I have done this my friend :) more over I do not have a SAM Instance to test it as well, but never mind let me at least point you in the right direction and others who are actively using SAM can pitch in and correct us:)ġ.
