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:
Procedure
- 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 8.8.8.8 > /tmp/ping.txt.
Results
The output for ping -c 4 8.8.8.8
is redirected to the ping.txt file.