> For the complete documentation index, see [llms.txt](https://docs.monokot.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.monokot.io/scripts/programming-examples/how-to-run-ping.md).

# How to: Run Ping

The guide demonstrates how to create an expression that runs the system ping command and convert the command output code to a Boolean value.&#x20;

{% hint style="warning" %}
Note that calling the *runAndWait* function will immediately put the script module into demo mode if it is not licensed
{% endhint %}

Open Monokot Server Administrator and double-click *Scripts* on the *Server Explorer* pane. Click *New Expression*, set the name *LinkState* for the expression that appears and set the return data type to *BOOLEAN*. Insert the following code into the expression code editor:

```javascript
var result = MosProcess.runAndWait('ping', 'google.com -n 1', 5000);

if (result.exitCode == 0)
  return true;   

return false;
```

Press *Ctrl + Enter* to apply the change in the code editor.

Go to the *Triggers* tab, click *Add Periodic* and set a period of 10,000 ms for the trigger. In order for the changes to take effect on the server, click the Sync button. Thus, the expression will check the connection with google.com host every 10 seconds and convert the *exitCode* returned by ping to Boolean value.

You can find the full set of MosProcess functions and their descriptions [<mark style="color:blue;">here</mark>](/scripts/api/mosprocess.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.monokot.io/scripts/programming-examples/how-to-run-ping.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
