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:


  1. In the Create Device Template wizard, proceed to the Commands step.
  2. Select Custom Command from the drop-down menu and enter a name for your command.
  3. Under Executable, enter the path as /bin/sh.
  4. Under Arguments, enter the path to the output file. For example, -c, /bin/ping -c 4 > /tmp/ping.txt.


The output for ping -c 4 is redirected to the ping.txt file.