[mythtv-users] mythbackend pid

Brad DerManouelian myth at dermanouelian.com
Sat Jun 30 01:52:03 UTC 2007


On Jun 29, 2007, at 6:23 PM, dropax wrote:

> You can use the PID from the pid file to check whether that process is
> still running.  Linux ubernewbie here only knows that the "top"  
> command
> shows pid, but I'm sure there are other commands which show active
> processes with less overhead or in a more easily parsed format.

This is how I would do it:

[mythtv at mythtv ~]$ perl -e '$pid=`ps -ae | grep mythbackend`; $pid  
=~ /^(\d+)/;print $1;'
27989[mythtv at mythtv ~]$

That should print out the pid of the currently running mythbackend  
process. If you exit abnormally or $pid doesn't match what the  
pidfile says, it's dead. You don't even need the pid, actually. If  
that command exits abnormally it means $pid is null and the regex  
will bail which means the backend is not running.

To paraphrase The Minutemen: hack! hack! hack!

-Brad



More information about the mythtv-users mailing list