How to tell if a certain program is running?

Mark True darfoo at framebuffer.org
Fri Jul 6 13:30:35 UTC 2007


You can do something like

ps ax |grep <thing> |grep -v grep

which says get me any instance of "thing" and exclude any line that
contains the word grep....

You can also add sed, awk etc to the command line to do furthur parsing of
the output ... hope that helps.

--Mark


----- Original Message -----
Subject: How to tell if a certain program is running?
Date: Fri, July 6, 2007 6:38
From: "Craig Hagerman" <craighagerman at gmail.com>

> I am wondering if there is a simple way to programatically tell if a
> given program is running. I want to write a bash script to check if a
> program is running, then if not start it.
>
> My first idea was to try to return grep the output from 'ps ax' but
> even if a program isin't running grep will return the request you just
> made. I am sure there is a more elegant way I don't know about.
>
> Craig
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
>




More information about the ubuntu-users mailing list