The Everyware Cloud Console provides the ability to run system commands directly on the device. In the Devices section of the Everyware Cloud Console, select a device that is currently connected and open the Command tab. This tab allows commands to be executed on the remote device.
The following operations can be performed from the Command tab:
- Execute a command on the remote device (Execute)
- Download a Zip file to the remote device (File)
To execute a simple command, type the command in the Execute field and click on the Execute button. The output of the command is returned by the remote device and displayed in the lower portion of the Command panel.
To clear the Execute and File parameters, click the Reset button.
It is also possible to send a script to be executed remotely using the File option of the Command tab. This script must be compressed into a zip file with the eventual associated resource files. The zip file is sent to the device embedded in an MQTT message. The Command Service in the device stores the file under the
/tmp directory, unzips it, and executes the command specified in the Execute field.
The Command example shown in this section uses a Zip file called cloud.zip that contains the following files in a flat directory format (no subdirectories):
- A file named test.sh that is intended to reside in the /etc/init.d/
- A script file named script.sh containing the following installation script:
#!/bin/sh echo -e "Executing command on remote device\n" mv test.sh /etc/init.d/ ls -l /etc/init.d/test.sh echo ifconfig
The following screen capture shows the Execute parameter set to
sh script.sh. The file
cloud.zip has been selected using the Browse button.
When you click the Execute button, the
cloud.zip file is downloaded to the remote device, its content is extracted into the
/tmp/ directory and the
cloud.zip file is deleted. Then the command
sh script.sh is executed at the remote device’s command line, which runs the
script.sh file that was just extracted. No path is necessary because the
/tmp/ directory is assumed by default.
The output of the resulting command is returned by the remote device and displayed in the lower portion of the Command panel. In this example, the script moved the file
/etc/init.d/, performed a directory listing to validate that the file was present in its correct location, and then did an
ifconfig command on the remote device.
Updated 11 months ago