# Linux Deployment Tutorial

Use our provided installation script to quickly launch the service with just a few commands. This script simplifies the setup process for the relay service by automating numerous configuration and installation steps. Actions performed by the script include:

* **Install prerequisites**: Installs essential tools including *Docker.*
* **Create the workplace**: Set up execution environments and download the *Docker* images.
* **Launch agent checking service**: Deploys and starts the checking service.

With these system requirements in check, you'll be well-prepared to start the deployment of your WatchDog agent.

{% hint style="info" %}
Should you encounter any issues or have questions, don't hesitate to seek support from the SendingNetwork [community](https://t.me/SendingNetworkOfficial/1).
{% endhint %}

## **Installation**

### **Step 1: Download Agent Installation Script**

Depending on your system, use the following command to download and install the deployment script:

{% tabs %}
{% tab title="Ubuntu or other Debian-based system" %}
{% code overflow="wrap" %}

```bash
sudo apt-get install -y wget && wget -N http://node4.sending.network:8120/watchdog_linux.sh  -P .
```

{% endcode %}
{% endtab %}

{% tab title="CentOS or other Red Hat-based system" %}
{% code overflow="wrap" fullWidth="false" %}

```bash
sudo yum install -y wget && wget -N http://node4.sending.network:8120/watchdog_linux.sh  -P .
```

{% endcode %}
{% endtab %}
{% endtabs %}

### **Step 2: Run the Installation Script**

Change the permissions of the script and execute the installation script by running:

{% code overflow="wrap" %}

```bash
sudo chmod 777 watchdog_linux.sh && ./watchdog_linux.sh
```

{% endcode %}

When prompted, enter your wallet address.&#x20;

{% hint style="warning" %}
Ensure you use a wallet address holding a valid License NFT. Each License NFT allows one active agent.
{% endhint %}

### **Step 3: Finish Installation**

Once enough gas is received, you'll see the following output, and your agent is up.&#x20;

```
{"wallet":"0xYourWalletAddress","status":1}
The WatchDog node is up and running.
```

If you are running the script directly, please do NOT run it with `sudo` as it will impact the agent daemon process. Instead, you can run it under a common user account, or by using sudo su or the root account.

```bash
./watchdog_linux.sh
```

***

### Check the status of WatchDog

To check if your agent is running, use the following command:

{% code overflow="wrap" %}

```sh
sudo docker ps -a | grep 'jack0818/watchdog' | grep -v grep | awk '{print $1}' | xargs sudo docker container inspect | grep '"Status": "running"'
```

{% endcode %}

If your agent is running, you will see the following output:

{% code overflow="wrap" %}

```
"Status": "running"
```

{% endcode %}

### Check your agent ID

To display your agent ID, use the following command:

```bash
cat ~/WatchdogNode/run/watchdog/peerinfo
```

### **Stop the agent**

To stop the agent, use the following commands.

1. **Find and stop the WatchDog daemon process:**

   ```sh
   sudo ps wxau | grep watchdog | grep sh | awk '{print $2}' | xargs sudo kill -9
   ```
2. **Stop and remove the Docker containers:**

   <pre class="language-sh" data-overflow="wrap"><code class="lang-sh">sudo docker ps -a | grep 'jack0818/watchdog' | awk '{print $1}' | xargs sudo docker stop | xargs sudo docker rm
   </code></pre>

### Restart the agent

To restart your WatchDog agent, follow these steps:

1. **Download the latest installation script:** In the original directory, obtain the latest script and run it.
2. **Maintain the original directory:** If you run the agent from a new directory other than the original one, it will create a new agent ID. Points will be accrued with this new ID, but previous points will remain valid under the original agent ID.

***

## Next Steps <a href="#next-steps" id="next-steps"></a>

After finishing the installation, interact with our auto-reply bot on the SendingMe app to check your agent's stats. SendingMe is an all-in-one web3 instant messaging app built on top of SendingNetwork. Refer to [Check Node Stats with Auto-Reply Bot in SendingMe](https://sending-network.gitbook.io/sending.network/edge-node-deployment-manuals/check-node-stats-with-auto-reply-bot-in-sendingme-app) for instructions on utilizing the bot to monitor your agent's performance.

Should you encounter any issues or have questions, don't hesitate to seek support from the SendingNetwork [community](https://t.me/SendingNetworkOfficial/1).


---

# Agent Instructions: 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:

```
GET https://sending-network.gitbook.io/sending.network/watchdog-agent/watchdog-agent-deployment-tutorial/linux-deployment-tutorial.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
