# program() Destination Driver

### Important Information

Usually, every message is a single line (ending with a newline character), which your script can process. Make sure that your script runs in a loop and keeps reading the standard input — it should not exit. (If your script exits, syslog-ng OSE tries to restart it.)

### Status <a href="#status" id="status"></a>

| Architecture | Status |
| :----------: | :----: |
|      x86     |  Works |
|      ARM     |  Works |

### How to Test <a href="#how-to-test" id="how-to-test"></a>

To test the program() destination driver, we will make a shell script that receives input and stores it into a file or displays it on the console. Then, using the program destination driver, we will pass a custom message to this script and see the results in the file.&#x20;

> Note: The script is started by the driver, and in case of a exit, it is restarted automatically.

#### Shell Script <a href="#shell-script" id="shell-script"></a>

```
#!/bin/sh
while read line ; do
echo $line >> /Users/yash/Documents/test.txt
done
```

#### Configuration File Used <a href="#configuration-file-used" id="configuration-file-used"></a>

```
@version: 3.31
@include "scl.conf"

source custom
{
    example-msg-generator(
        num(20)
        freq(2)
        template("Random Message")
    );
};

destination d_prog { 
    program("/Users/yash/Documents/script"); 
};


log {
    source(custom);
    destination(d_prog);
};
```

#### Proof

![Testing program() destination on macOS (x86)](https://3267548193-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MaZdBoDvCx_0JwOUICk%2F-McEP3xPF36ZzsdyN8Lc%2F-McEPMStRCgWB2V66k4a%2FScreenshot%202021-06-15%20at%202.23.06%20PM.png?alt=media\&token=674c1814-f7ba-417b-b832-e1dc90daa7b4)

![Testing program() destination on macOS (ARM)](https://3267548193-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MaZdBoDvCx_0JwOUICk%2F-MhXn5_Uy8Ayiemsnkwk%2F-MhXo5HnDTzS-bnE5lbf%2FScreen%20Shot%202021-08-20%20at%2012.06.18%20PM.png?alt=media\&token=5a15b1d4-fe93-4617-8913-65ad907e3b99)


---

# 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://syslog-macos-testing.gitbook.io/syslog-macos-testing/modules/afprog-2/program-destination-driver.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.
