This scenario describes how to use the CLI to configure the device to update the firmware and configuration at a specified interval. The firmware is updated before the configuration. The firmware and configuration are downloaded from an external server (see File download from a TFTP or HTTP(S) server) using the ‘LoadFirmware’ and ‘LoadConfig’ commands in combination with dynamic file names. The scheduling is organized with cron jobs.
-
Specify the URL that the 'LoadFirmware' command uses to source the upload if no other parameters are available. For example, to upload the firmware from an HTTP server, the command would resemble the following:
set /Setup/Autoload/Network/Firmware/URL http://www.mycompany.de/firmware/
The file name is specified later by the cron job.
-
Set the conditions for loading the firmware such that only firmware that is newer than that in the device is loaded:
set /Setup/Autoload/Network/Firmware/Condition if-newer
-
Specify the path that the 'LoadConfig' command uses to source the upload if no other parameters are available. For example, to upload the configuration from an HTTP server, the command would look similar to the following:
set /Setup/Autoload/Network/Firmware/URL http://www.mycompany.de/configuration
The file name is specified later by the cron job.
-
Set the conditions for loading the configuration such that only a configuration that is different from that in the device is loaded:
set /Setup/Autoload/Network/Config/Condition if-different
-
Create a cron job that regularly runs the command 'LoadFIRMWARE' every 10 minutes:
cd /Setup/Config/Cron-Tabelle
set 1 * * * 10 * * * * LoadFirmware\ $__SERIALNO-Device.upx
In the example above, the firmware on the HTTP server must be in the form
<SerialNumber>-Device.upx, for example
000018100060-Device.upx.
Important: In the cron command LoadFirmware \ $__SERIALNO-Device.upx, the space between the load command and the environment variables is protected with a backslash. Trying to use the alternative notation of enclosing the entire command in quotation marks will result in an error. LCOS treats environment variables in quotation marks as normal text, so that any variables would be ignored.
-
Create a cron job that regularly runs the command 'LoadConfig' every 10 minutes:
set 2 * * * 10 * * * * LoadScript\ $__SERIALNO-$__FWVERSION.lcs
In the example above, the configuration script on the HTTP server must be in the form
<SerialNumber>-<FirmwareVersion>.lcs, for example
000018100060-8.84.lcs.
That's it! With this configuration, the device always initially loads the latest firmware.
If the device executes the command 'LoadScript' after initially uploading the latest firmware and the latest configuration script (e.g. for version 8.84) from the HTTP server, then the environment variable '__FWVERSION' is, at this time, set with the value of the previous firmware, e.g. '8.80 ‘. The command LoadScript\ $__SERIALNO-$__FWVERSION.lcs does not find a suitable configuration script at this time. The device then executes the command LoadFirmware 000018100060-Device.upx and after rebooting, the environment variable '__FWVERSION' is set to the value '8.84 '. The command LoadScript\ $__SERIALNO-$__FWVERSION.lcs then finds a suitable script to update the configuration.