[PLUG] Check program running...

drew wymore drew.wymore at gmail.com
Tue Jan 23 18:15:12 UTC 2007


just use pidof `process name`

On 1/22/07, plug_0 at robinson-west.com <plug_0 at robinson-west.com> wrote:
>
> I have a perl socket program called setdodoip.pl.
>
> I want to make sure it is running from a bash script.
>
>
> There is the option of doing:
>
> `ps ax|grep 'setdodoip.pl'|tr -s ' '|cut -d ' ' -f1`
>
> to get a process id if setdodoip.pl is running.
>
>
> Hmm, isn't there an easier, generic, and more reliable
> way to check if a program is running than trying to
> filter the process id of it from the output of the ps
> command?
>
> One thought is to have setdodoip.pl create a file when it
> starts.  Trouble is, that file could still exist when
> setdodoip.pl isn't running.  In the perl script, can I
> add deleting the file I create when the process is
> killed or doesn't start?
>
>       Michael C. Robinson
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list