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 CENTOS
bundle-package
BUNDLE-PACKAGE(1) BUNDLE-PACKAGE(1)
NAME
bundle-package - Package your needed .gem files into your application
SYNOPSIS
bundle package
DESCRIPTION
Copy all of the .gem files needed to run the application into the vendor/cache directory. In the future, when running bundle install(1)
bundle-install.1.html, use the gems in the cache in preference to the ones on rubygems.org.
GIT AND PATH GEMS
Since Bundler 1.2, the bundle package command can also package :git and :path dependencies besides .gem files. This needs to be explicitly
enabled via the --all option. Once used, the --all option will be remembered.
REMOTE FETCHING
By default, if you simply run bundle install(1) bundle-install.1.html after running bundle package(1) bundle-package.1.html, bundler will
still connect to rubygems.org to check whether a platform-specific gem exists for any of the gems in vendor/cache.
For instance, consider this Gemfile(5):
source "https://rubygems.org"
gem "nokogiri"
If you run bundle package under C Ruby, bundler will retrieve the version of nokogiri for the "ruby" platform. If you deploy to JRuby and
run bundle install, bundler is forced to check to see whether a "java" platformed nokogiri exists.
Even though the nokogiri gem for the Ruby platform is technically acceptable on JRuby, it actually has a C extension that does not run on
JRuby. As a result, bundler will, by default, still connect to rubygems.org to check whether it has a version of one of your gems more spe-
cific to your platform.
This problem is also not just limited to the "java" platform. A similar (common) problem can happen when developing on Windows and deploy-
ing to Linux, or even when developing on OSX and deploying to Linux.
If you know for sure that the gems packaged in vendor/cache are appropriate for the platform you are on, you can run bundle install --local
to skip checking for more appropriate gems, and just use the ones in vendor/cache.
One way to be sure that you have the right platformed versions of all your gems is to run bundle package on an identical machine and check
in the gems. For instance, you can run bundle package on an identical staging box during your staging process, and check in the ven-
dor/cache before deploying to production.
March 2013 BUNDLE-PACKAGE(1)