I have the following bash code which checks that a process is running:
is_running() {
ps `cat "$pid_file"` > /dev/null 2>&1
}
The problem is that is_running
is always evaluated to true
.
$pid_file
contains a process ID that isn't listed when I run ps
.
I would like in this case, is_running
to return false
.
How can I modify it for that purpose?