Upload Config: Unterschied zwischen den Versionen

Aus Gude Systems GmbH
Zur Navigation springen Zur Suche springen
 
Zeile 1: Zeile 1:
If you want to configure multiple devices the same way, you can upload a CLI file using the http command [https://curl.haxx.se/download.html curl].
+
If you want to configure multiple devices the same way, you can upload a CLI file using the http command [https://curl.haxx.se/windows/ curl].
  
 
Here, we want to enable the device's NTP client, and have one Timer-Rule configured in multiple devices identically.
 
Here, we want to enable the device's NTP client, and have one Timer-Rule configured in multiple devices identically.
  
config.txt sets up the configuration, upload.sh is used to upload the config and reboot to apply:
+
config.txt sets up the configuration, upload.bat is used to upload the config and reboot to apply:
   ./upload.sh config.txt 192.168.0.2
+
   upload.bat config.txt 192.168.0.2
   ./upload.sh config.txt 192.168.0.3
+
   upload.bat config.txt 192.168.0.3
   ./upload.sh config.txt 192.168.0.4
+
   upload.bat config.txt 192.168.0.4
  
 
= config.txt =
 
= config.txt =
Zeile 38: Zeile 38:
 
  # Start Timer engine
 
  # Start Timer engine
 
  timer enabled set ON
 
  timer enabled set ON
 +
 +
= upload.bat =
 +
@echo off
 +
 +
REM Upload FirmwareFile
 +
curl.exe --verbose -F file=@%1 "http://%2/fwupdate.txt?type=2"
 +
 +
REM Reboot
 +
curl "http://$2/status.json?cmd=39"
  
 
= upload.sh =
 
= upload.sh =

Aktuelle Version vom 14. Februar 2020, 10:43 Uhr

If you want to configure multiple devices the same way, you can upload a CLI file using the http command curl.

Here, we want to enable the device's NTP client, and have one Timer-Rule configured in multiple devices identically.

config.txt sets up the configuration, upload.bat is used to upload the config and reboot to apply:

 upload.bat config.txt 192.168.0.2
 upload.bat config.txt 192.168.0.3
 upload.bat config.txt 192.168.0.4

config.txt

# Enable NTP Client
clock ntp server 0 set "0.pool.ntp.org"
clock ntp server 1 set "1.pool.ntp.org"
clock ntp enabled set 1


# Delete all Pre-Configured Timers
timer delete all


# Set Up New Timer:
# Timer1: Mo-Fr from 09:00:00 to 17:00:00 : Port 1 ON

timer 1 name set "Port1 on from 9to5 weekdays" 
timer 1 trigger HOUR set "9"
timer 1 trigger MIN  set "0"
timer 1 trigger SEC  set "0"
timer 1 trigger DAY  set "ALLSET"
timer 1 trigger MON  set "ALLSET"
timer 1 trigger DOW  set "0,1,2,3,4"

timer 1 action mode set SWITCH
timer 1 action SWITCH1 ON  set "1" 
timer 1 action SWITCH2 OFF set "1"
timer 1 action delay set 28800 
timer 1 enabled set 1

# Start Timer engine
timer enabled set ON

upload.bat

@echo off

REM Upload FirmwareFile
curl.exe --verbose -F file=@%1 "http://%2/fwupdate.txt?type=2"

REM Reboot
curl "http://$2/status.json?cmd=39"

upload.sh

#!/bin/bash

# Upload Config File
curl -F file=@./$1 "http://$2/fwupdate.txt?type=2"

# Rebot to apply
curl "http://$2/status.json?cmd=39"