diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index c766e79e..43195f9d 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -308,7 +308,7 @@ CHECKTEMP(){ [ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' ' if [ "${TTYPE}" == "fans" ]; then tmp="${lmd}${spct}${temp_f}${GAUGESH}" - c=0; spc=''; spc1=`expr ${fws} - ${#tmp} + 4`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done + c=0; spc=''; spc1=`expr ${fws} - ${#tmp} + 5`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done echo -e "${spc}${idsCL[Default]}[ ${idsCL[Green]}${GL_LOW}°F${idsCL[Default]} <--> ${idsCL[LightYellow]}${GL_HIGH}°F${idsCL[Default]} ]" else tmp="${spct}${temp_f}${GAUGESH}" @@ -970,6 +970,16 @@ Previous Temp: ${last_temp}${GAUGESH}" if [ "${QRY}" != "" ]; then ${mysql_conn} -e "${QRY}" echo "${temp_f}" >| ${PW_TMPFOLDER}/.lastinsert/${SENSOR} + if [ ! -f ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre ]; then + echo "${temp_f}" > ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre + + elif ([ ! -f ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre)) -ge 900 ]) || ([ -f ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old)) -ge 900 ]); then + mv ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old 2> /dev/null + echo "${temp_f}" > ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre + + fi + + fi # if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then # ${mysql_conn} -e "USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID["${SENSORa}-Probe"]}','$(date +'%Y-%m-%d %H:%M:%S')','${temp_probe_f}')"