This section provides an example to redirect outputs using the VMware Pulse IoT Center Custom Command feature.
You can run a script or a binary on a gateway and redirect its output to a file. You can then retrieve the output file using the Upload command. In this example, we run a ping on a gateway to detect its connectivity to a certain endpoint. To perform this operation, you must wrap the command into a shell by providing the
/bin/sh path as the executable, and pass the actual binary and arguments to the shell. You must then pass the
-c argument to interpret the rest of the arguments as binary and associate the arguments to the binary. Perform the following steps:
- In the Create Device Template wizard, proceed to the Commands step.
- Select Custom Command from the drop-down menu and enter a name for your command.
- Under Executable, enter the path as /bin/sh.
- Under Arguments, enter the path to the output file. For example, -c, /bin/ping -c 4 220.127.116.11 > /tmp/ping.txt.
The output for
ping -c 4 18.104.22.168 is redirected to the ping.txt file.