update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
VERS='2.2.20-08142023'
|
||||
VERS='2.2.40-08182023'
|
||||
|
||||
noheader=' update service dailytemp '
|
||||
|
||||
|
||||
17
powerwall.sh
17
powerwall.sh
@@ -306,12 +306,21 @@ NORMAL TEMP: ${temp_f}'F"
|
||||
wait=300
|
||||
fi
|
||||
if [ ${lastinsert} -ge ${wait} ]; then
|
||||
if [ "${temp_h}" != "" ]; then
|
||||
QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`, \`hum\`) VALUES ('${PW_SENSOR_ID[${SENSOR}]}','${datetime}','${temp_f}','${temp_h}')"
|
||||
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
|
||||
entityid=($(${mysql_conn} -e "SELECT id FROM servermonitor.entities WHERE BINARY name='${vSENSOR// /_}' AND sensorid='${PW_SENSOR_ID[${SENSORa}]}'"))
|
||||
if [ "${entity[1]}" == "" ]; then
|
||||
${mysql_conn} -e "USE servermonitor; INSERT INTO entities (\`sensorid\`, \`name\`) VALUES ('${PW_SENSOR_ID[${SENSORa}]}','${vSENSOR// /_}')"
|
||||
entityid=($(${mysql_conn} -e "SELECT id FROM servermonitor.entities WHERE BINARY name='${vSENSOR// /_}' AND sensorid='${PW_SENSOR_ID[${SENSORa}]}'"))
|
||||
fi
|
||||
entityid=${entityid[1]}
|
||||
|
||||
QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`entity\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID[${SENSORa}]}','${entityid}','${datetime}','${temp_f}')"
|
||||
elif [ "${temp_h}" != "" ]; then
|
||||
QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`, \`hum\`) VALUES ('${PW_SENSOR_ID[${SENSORa}]}','${datetime}','${temp_f}','${temp_h}')"
|
||||
else
|
||||
QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID[${SENSOR}]}','${datetime}','${temp_f}')"
|
||||
QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID[${SENSORa}]}','${datetime}','${temp_f}')"
|
||||
fi
|
||||
# ${mysql_conn} -e "${QRY}"
|
||||
${mysql_conn} -e "${QRY}"
|
||||
touch ${PW_TMPFOLDER}/${SENSOR}.insert
|
||||
fi
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user