---
title: "How to automatically restart a process if it goes down"
description: "Geneos can be configured to automatically restart a process if it goes down using a Processes sampler and defined rules. This involves detecting process failure, running a restart script, and escalating if the restart does not succeed."
url: "https://docs.itrsgroup.com/docs/faq/geneos/115004031309-geneos-how-to-automatically-restart-a-process-if-it-goes-down/index.html"
---
**Yes, Geneos can be configured to restart a process which has gone down, review the instructions below on how to achieve this.**

Firstly you should setup a [Processes sampler](https://docs.itrsgroup.com/docs/geneos/current/collection/processes/index.html#Processes) on the same machine which has the process you want to try and restart. Once run up you will see a view like below:

![Geneos - How to automatically restart a process if it goes down](https://docscdn.itrsgroup.com/faq/images/geneos/115004031309-remote-060-process-plugin-e119a866d807.jpg)

We are interested in the instance count column. We need to define a rule which detects the process dropping and running a script:

```
<rule name="Restart Process">
 <targets>
 <target>/geneos/gateway[(@name=&quot;systemAlerts&quot;)]/directory/probe[(@name=&quot;iwhddb2&quot;)]/managedEntity[(@name=&quot;Helpdesk DB&quot;)]/sampler[(@name=&quot;processes&quot;)][(@type=&quot;process&quot;)]/dataview[(@name=&quot;processes&quot;)]/rows/row[(@name=&quot;mysqld&quot;)]/cell[(@column=&quot;instanceCount&quot;)]</target>
 </targets>
 <priority>1</priority>
 <pathAliases>
 <pathAlias name="num">../../rows/row/cell[(@column=&quot;City&quot;)]</pathAlias>
 </pathAliases>
 <evaluateOnDataviewSample>false</evaluateOnDataviewSample>
 <block>
 <if>
 <and>
 <equal>
 <dataItem>
 <property>@value</property>
 </dataItem>
 <integer>0</integer>
 </equal>
 <lt>
 <dataItem>
 <property>state/@severity</property>
 </dataItem>
 <integer>2</integer>
 </lt>
 </and>
 <transaction>
 <delay unit="samples">2</delay>
 <update>
 <property>state/@severity</property>
 <severity>warning</severity>
 </update>
 <action ref="Run Start Script"></action>
 </transaction>
 <if>
 <and>
 <equal>
 <dataItem>
 <property>state/@severity</property>
 </dataItem>
 <severity>warning</severity>
 </equal>
 <equal>
 <dataItem>
 <property>@value</property>
 </dataItem>
 <integer>0</integer>
 </equal>
 </and>
 <transaction>
 <delay unit="samples">2</delay>
 <update>
 <property>state/@severity</property>
 <severity>critical</severity>
 </update>
 </transaction>
 <transaction>
 <update>
 <property>state/@severity</property>
 <severity>ok</severity>
 </update>
 </transaction>
 </if>
 </if>
 </block>
</rule>
```

We have added the [delay 2 samples](https://docs.itrsgroup.com/docs/geneos/current/processing/monitoring-and-alerts/geneos_rulesactionsalerts_tr/index.html#Delay) to ensure the process is truly down, and a further escalation to critical in case the restart does not work.

The Action definition:

```
<action name="Run Start Script">
 <script>
 <exeFile>./startMyProcess.sh</exeFile>
 <arguments>
 <data></data>
 </arguments>
 <runLocation>netprobe</runLocation>
 <probe ref="Netprobe"></probe>
 </script>
</action>
```

There will need to be a script relative to the Netprobe which you invoke. The name and path of which should replace the ./startMyprocess.sh in the action definition above.


