05-26-2010
Command to check if a particular process is running
Hi
What is the best command to check if a particular process is running in a linux server or not
To check any java process, I use the below command.
ps -ef |grep jvm
When I execute the above command, it lists me all the processess . The above command should ideally return only the processess that are running in the server. But even if the particular jvm process is not running/it has been stopped, it gives them as results as well.
Please adivse, How to check this.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have this script:
-------------------------------------------------------
#!/bin/ksh
#
if ] ||
]
then
echo "Executing main_load.sh script"
/usr1/psc_load/jobs/cron/main_load.sh "ods"
else
echo "File not found, do nothing"
fi
exit 0
... (4 Replies)
Discussion started by: rose1207
4 Replies
2. Shell Programming and Scripting
How do I make a shell script to see if a certain process is running.
The process shows up on ps aux as /usr/sbin/daemon
eg:
if
/usr/sbin/daemon
else
#nothin
basically i want to run the process if it isnt running/ has been stopped.
Thanks. (2 Replies)
Discussion started by: daydreamer
2 Replies
3. Shell Programming and Scripting
Hi ,
I have a csh code below which check the process if it's running.
Can any expert advise me on the following:
1) what does this notationmean ">!" and how is it different from the append ">" notation ?
2) how does "setenv" work in this code ?
# Check whether there is a running... (3 Replies)
Discussion started by: Raynon
3 Replies
4. UNIX and Linux Applications
Hi
I would like to check if an instance of a script is already running.
I've seen many different examples, but I haven't the slightest idea as to how to do this.
Can you please help.
Thank you. (5 Replies)
Discussion started by: ladyAnne
5 Replies
5. Programming
How to I check if a process is running in C? I'm trying to use ps aux |grep "process name" but failing in doing that. How do I do that?
Thanks, (1 Reply)
Discussion started by: cprogdude
1 Replies
6. Shell Programming and Scripting
Hi,
Can anyone please tell me how to write a shell script to check
whether a process if running or not.... if its still running then wait for sometime and if not then run the next query.
Also, Under my one main script main.sh I have to run 2 scripts simutaneously which take some time to... (2 Replies)
Discussion started by: lovepujain
2 Replies
7. Shell Programming and Scripting
Hi,
I check if the process is running or not using the below.
/usr/ucb/ps auxww | grep 109 |grep rmi | awk '{print $2}'
9718
Thus we see 9718 is the PID.
It return blank if the process is not running.
I need to perform some action if the process is not running and leave it if... (8 Replies)
Discussion started by: shifahim
8 Replies
8. UNIX for Dummies Questions & Answers
I have process1 running on one machine and generating some log file. Now another process which can be launched on any machine wants to know if process1 is running or not and also in case it is running it wants to stream the logs file generated by process1 on terminal from which process2 is... (2 Replies)
Discussion started by: saurabhnsit2001
2 Replies
9. Shell Programming and Scripting
Hi Gurus,
t=`ps -u irb|grep -v grep|grep BSNL_PAYMENT_C`
echo $t
if
then
echo $?
echo "Process Creation is Running ...."
else
echo "Process went down at $dat $tim"
fi
How would i use loop so that the script continously checks for the current status of this process.... (1 Reply)
Discussion started by: ankitknit
1 Replies
10. Shell Programming and Scripting
Hello,
Could someone do the following bash ubuntu script for me? I have 5 screen processes of bot:
SCREEN -dmS Xbot_instance_1 php core.php -i 1
SCREEN -dmS Xbot_instance_2 php core.php -i 2
SCREEN -dmS Xbot_instance_3 php core.php -i 3
SCREEN -dmS Xbot_instance_4 php core.php -i 4
... (2 Replies)
Discussion started by: kotch
2 Replies
LEARN ABOUT SUNOS
create-jvm-options
asadmin-create-jvm-options(1AS) User Commands asadmin-create-jvm-options(1AS)
NAME
asadmin-create-jvm-options, create-jvm-options - creates the JVM options from the Java configuration or profiler elements
SYNOPSIS
create-jvm-options --user admin_user [--password admin_password][--host localhost] [--port 4848] [--secure|-s] [--passwordfile filename]
[--terse=false] [--echo=false] [--interactive=true] [--profiler=false
](jvm_option_name=jvm_option_value)[:jvm_option_name=jvm_option_value]*
Creates the JVM options in the Java configuration or Profiler elements of the domain.xml file. You can enter more than one JVM option sepa-
rated by a colon (:) . If the JVM option starts with a dash (-) then use two dashes (--) before the operand to distinguish that JVM option
is an operand and not an option. JVM options are used to record the settings needed to get a particular profiler going.
You must restart the server for the newly created JVM options to take affect. Use the start-domain command to restart the server domain.
OPTIONS
--user authorized domain application server administrative username.
--password password to administer the domain application server.
--host machine name where the domain application server is running.
--port port number of the domain application server listening for administration requests.
--secure if true, uses SSL/TLS to communicate with the domain application server.
--passwordfile file containing the domain application server password.
--terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well-
formatted data for consumption by a script. Default is false.
--echo setting to true will echo the command line statement on the standard output. Default is false.
--interactive if set to true (default), only the required password options are prompted.
--profiler indicates if the JVM options is for the profiler. Profiler must exist for this option to be true.
OPERANDS
jvm_option_name=jvm_optithevleft side of the equal sign (=) is the JVM option name. The right side of the equal sign (=) is the
jvm_option_value. Additionally, you can use ":" as a delimiter for more than one jvm-option. If the jvm-option
contains a ":", use the escape character to offset the ":" delimiter.
Example 1: Using create-jvm-options
asadmin> create-jvm-options --user admin --password adminadmin
--host localhost --port 4848 --profiler=false --DDebug=true:"-Xmx256m":"
-Dcom.sun.aas.imqBin"="/export/as7se/imq/bin"
Command create-jvm-options executed successfully
Where the JVM options are created. The double dash (--) is used between --profiler options and the operand because - indicated the end of
the options and the following text is the operand. The double dash (--) is necessary here since there are single dashes (i.e., --DDebug) in
the operand. To distinguish between the options and the operand, the double dash (--) is used.
EXIT STATUS
0 command executed successfully
1 error in executing the command
asadmin-delete-jvm-options(1AS)
J2EE 1.4 SDK March 2004 asadmin-create-jvm-options(1AS)