<p>I have a file in <code>/tmp/healthy</code> as mentioned in official documentation and YAML is available</p>
<pre><code>livenessProbe:
  exec:
    command:
    - cat
    - /tmp/healthy
</code></pre>
<p>But in my case file always be here and it will contain message like Success or Failure</p>
<p>It is possible with <code>livenessProbe:command</code> to behave on these messages?</p>

Umair
<p>yes, you can use the <code>grep</code> command to search for <code>Success</code> string, if it is found it would return <code>0</code>(passing the probe) , however if <code>Success</code> string is not found by <code>grep</code> it would return <code>non-zero</code> rc(failing the probe)</p>
<pre><code>livenessProbe:
  exec:
    command:
    - grep
    - Success 
    - /tmp/healthy
</code></pre>
<p>As per documentation</p>
<blockquote>
<p>If the command succeeds, it returns 0, and the kubelet considers the
container to be alive and healthy. If the command returns a non-zero
value, the kubelet kills the container and restarts it.</p>
</blockquote>
<p>This means, <code>exec</code> type depends on the return code of the command. as long as <code>grep</code> is returning success , probe will pass.  In shell return code of any command can be manually checked via <code>$?</code> variable. Eg: :</p>
<pre><code>grep Success /tmp/healthy; echo $?
</code></pre>
