# Command execution

**URL:** <https://discourse.sensu.io/t/command-execution/1751>\
**Category:** Sensu Go\
**Created:** [May 2, 2020, 8:18am UTC](https://discourse.sensu.io/t/command-execution/1751 "2020-05-02T08:18:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sathish](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@Sathish](https://discourse.sensu.io/u/Sathish)\
**Post date:** [May 2, 2020, 8:18am UTC](https://discourse.sensu.io/t/command-execution/1751/1 "2020-05-02T08:18:12Z")

</div>

Hi Team, I am new to this sensu go and my organization too.  
I want solution:  
I have two servers from AWS and one is installed nginx with sensu agent and one is installed sensu-backend.  
I want to start if nginx is stop, Through sensu-backend by pusing the command. Is that possible on our sensu go and please help me to find out the solution.

---

<div class="post-metadata">

**Author:** ![ganeshkatakam](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/ganeshkatakam/32/276_2.png) [@ganeshkatakam](https://discourse.sensu.io/u/ganeshkatakam)\
**Post date:** [May 3, 2020, 4:20pm UTC](https://discourse.sensu.io/t/command-execution/1751/2 "2020-05-03T16:20:28Z")

</div>

Yes, it is possible. You can use the remediation handler and create a remediation check for restarting the nginx server. You can find the process for creating remediation checks from [https://github.com/sensu/sensu-remediation-handler](https://github.com/sensu/sensu-remediation-handler)

---

<div class="post-metadata">

**Author:** ![Sathish](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@Sathish](https://discourse.sensu.io/u/Sathish)\
**Post date:** [May 3, 2020, 4:24pm UTC](https://discourse.sensu.io/t/command-execution/1751/3 "2020-05-03T16:24:14Z")

</div>

Thank you Ganesh, I Using this but remediation check is published so, it’s running the command everytime and I want to run the remediation check when…nginx is not responding 200 is failed mean…it has to run…

---

<div class="post-metadata">

**Author:** ![Luc\_Dandoy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/luc_dandoy/32/150_2.png) [@Luc\_Dandoy](https://discourse.sensu.io/u/Luc_Dandoy)\
**Post date:** [May 4, 2020, 7:59pm UTC](https://discourse.sensu.io/t/command-execution/1751/4 "2020-05-04T19:59:59Z")

</div>

Did you try to use [Check Hooks](https://docs.sensu.io/sensu-go/latest/reference/checks/#check-hooks)?

We are using them in order to restart some service.  
Since the sensu user doesn’t have the access right to restart services with systemctl, we had to use some sudo rules, but so far it’s working OK

---

<div class="post-metadata">

**Author:** ![aaronsachs](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/aaronsachs/32/47_2.png) [@aaronsachs](https://discourse.sensu.io/u/aaronsachs)\
**Post date:** [May 4, 2020, 8:02pm UTC](https://discourse.sensu.io/t/command-execution/1751/5 "2020-05-04T20:02:07Z")

</div>

@Sathish the remediation check should be _unpublished_. By publishing it, you’re guaranteeing that it will run if you want it to or not. It must be unpublished so that when the remediation handler makes its API call, the check is only run once.

---

<div class="post-metadata">

**Author:** ![Sathish](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@Sathish](https://discourse.sensu.io/u/Sathish)\
**Post date:** [May 5, 2020, 2:46am UTC](https://discourse.sensu.io/t/command-execution/1751/6 "2020-05-05T02:46:37Z")

</div>

Yes, that’s correct @aaronsachs. Now it’s working fine.

---

<div class="post-metadata">

**Author:** ![Sathish](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@Sathish](https://discourse.sensu.io/u/Sathish)\
**Post date:** [May 5, 2020, 2:47am UTC](https://discourse.sensu.io/t/command-execution/1751/7 "2020-05-05T02:47:09Z")

</div>

No, I try this too…
