# Automation

Create new file auto.sh

```
sudo nano auto.sh
```

Paste Code below to the file and save the file with CTRL+X , Y and Enter

```
#!/bin/bash

# Path to the light-node executable
LIGHT_NODE="./light-node"

# Infinite loop to keep the script running
while true; do
    # Run the light-node
    $LIGHT_NODE

    # Check the exit status of the light-node
    if [ $? -eq 0 ]; then
        echo "light-node exited normally. Restarting in 5 seconds..."
    else
        echo "light-node crashed or exited with an error. Restarting in 5 seconds..."
    fi

    # Wait for 5 seconds before restarting
    sleep 5
done
```

Give permission to the file auto.sh

```
chmod +x auto.sh
```

Run the automation

```
./auto.sh
```


---

# 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://documentation.codeblocklabs.com/blockchain-nodes/layeredge/automation.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.
