How to tell if a certain program is running?

Craig Hagerman craighagerman at gmail.com
Fri Jul 6 14:12:02 UTC 2007


On 7/6/07, Phillip Johnson <phillipj at ptd.net> wrote:
> I have done this in the past.
>
> ps ax | egrep <name> | egrep -v egrep
>


Thanks to all who replied. For now, I like the simplicity of the
modified 'ps' options offered.

I will check out the start-stop-daemon and learn more about that, but
I am not sure if it is applicable in my case. Likewise, I don't think
that /var/run/prog.pid will get me anywhere.

I am asking in general for any given program, but right now the case
at hand involves restarting Azureus (and other network apps). If
Azureus or other programs are running and active my phone quality
suffers and I often can't send faxes. I made a little script and
linked it to a hot key on the keyboard so that I or my girlfriend can
shut down any of these apps before sending a fax. There IS a hot key
to restart, but she never does. For that reason, if I wanted to leave
Azureus running I wanted a cron script to check if it is running and
start it up. I have a script to start it already, I just need a way to
see if it is running already or not. Azureus is a java app and as far
as I can tell doesn't have an entry in /var/run/whatever. I haven't
read enough yet to know of start-stop-daemon will be of use or not. I
will check that out, but in the meantime use a modified 'ps' command.

Thanks again,

Craig




More information about the ubuntu-users mailing list