diff options
Diffstat (limited to 'mdkonline.pm')
-rw-r--r-- | mdkonline.pm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mdkonline.pm b/mdkonline.pm index 3b15b72b..d1d4d0eb 100644 --- a/mdkonline.pm +++ b/mdkonline.pm @@ -221,4 +221,13 @@ LASTCHECK=$d ); } +sub is_running { + my ($name) = @_; + any { + my ($ppid, $pid, $n) = /^\s*(\d+)\s+(\d+)\s+(.*)/; + #- to run ps, perl may create some process with $name as name and 1 as ppid + $ppid != 1 && $pid != $$ && $n eq $name; + } `ps -o '%P %p %c' -u $ENV{USER}`; +} + 1; |