Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Sensor values download script for Linux bash.

Edit correct HOSTIP, and PARAM (if needed) and save the file (sensors.shfor example). Execute it from the Linux console. Sensors values are saved in a “dump.xmlfile.

Parameters:

  • id

    -

    Dump

    for

    sensor

    with

    the

    specified

    id

    ID;

  • txt=true

    -

    csv

    CSV dump;

Code Block
languagebash
#!/bin/sh
# measurements result script

# host address
HOSTIP="192.168.1.190"
# user name
USERNAME="guest"
# user password
PASSWORD="guest"
# dumplog file
DUMPFILE="dump.xml"
# parametrs
PARAM=""
#here: dump - in text form, only for sensor with id=1001 
# PARAM="&txt=true&id=1001"

# 1) hash
HASH=`echo -n ${PASSWORD} | openssl dgst -sha1 | awk '{print $NF}'`

# 2) authorization
RESPONSE=`curl -s -d "querytype=auth&name=${USERNAME}&h=${HASH}" "${HOSTIP}/engine.htm"`

# 3) session key
KEY=`echo -n  ${RESPONSE} | awk -F"\"" '{print $4}'`

# 4) unloading dump
curl -s "${HOSTIP}/dump.htm?k=${KEY}${PARAM}" -o ${DUMPFILE}

...