Skip to content
dswd edited this page Mar 11, 2014 · 6 revisions

Executable Archives are an easy way to control your devices or transmit data to them, without opening any network connection to your device.

How it works

###Upload and Download Every device has an archive directory. You can download its content as an archive, or upload own data and thereby replacing the current content of an archive.

###Automatic execution When you upload an archive, the testbed device will look for a bash script called auto_exec.sh in the archive's root directory. If this start script exists, it will be executed after the archive has been extracted. A ToMaTo client can check the state of execution (running or finished?) at any time.

If the device is in state prepared at the time of uploading, the auto-execution will be done after the next start.

###Custom status Additionally, the start script (or any other program) can set a custom status which can also be read at any time by ToMaTo clients. This can serve as a one-way communication from your device to a topology control program or to show it in the web frontend.

###Status update interval In order to save resources, element information is cached by the backend. This affects the age of the information. When an archive has been uploaded, the information will be updated frequently (i.e., every second). As time passes, this update interval will become slower. The information is never older than 1/20 of the time which passed since the last device start or archive upload.

##The start script The start script should start with a shebang, so that it can be executed directly. It has the following environment variables:

  • $nlxtp_dir or $archive_dir - the path to the archive directory.
  • $archive_version - the version of the guest modules
  • archive_setstatus - a command which can be used to set the custom status (for bash scripts)

##Devices ###states Executable archives are not available in the state created. On KVM devices, uploading is not possible while the device is started.

###Guest Modules In order to run the auto-execution, the testbed device must be set up. It requires the nlXTP guest modules (link coming soon). The guest modules consist of a daemon, which waits for the start script to appear, and a monitor, which loads the start script with the correct environment variables and monitors its execution status.

Guest modules are currently only available for linux systems. If you are unsure whether a template has the guest modules installed, check whether you see a "not-installed" warning in the device's configuration window.

If guest modules are missing, upload and download are still possible. Check the description of the device type for more information.

##The Status Directory To realize the communication from the device to ToMaTo, executable archives use the so-called status directory. It is usually found as a directory called exec_status in the archive dir.

If the status directory exists, auto-execution will not be done in order to prevent multiple executions.

###Contents Usually, you should not need to touch its contents (except for the custom status). It may contain the following files:

  • custom A file which contains the custom status.
  • running A file which has a unix timestamp written to it. If it exists and the timestamp is not older than 10 minutes, the script is assumed to be running.
  • done An empty file. If it exists, the script is assumed to have finished without a crash.