June 21, 201412 yr Kind of off topic, but do any of you linux gurus out there know why my script only reads the variables the first time and not the second? IE Hard drive temps are not updated, only pulled on the first pass. #!/bin/bash nospamphone=0 while : do pnumber=$"xxxxxxxxxx" time=$(date +"%m-%d-%y %I:%M") hdspacetot=$(df -h /mnt/user/ ~ | awk 'NR==2 {print $2}') hdspacefree=$(df -h /mnt/user/ ~ | awk 'NR==2 {print $4}') uptime=$((w ~ | awk 'NR==1 {print $3}') | cut -d "," -f 1) exec 6<>/dev/tcp/192.168.2.4/80 && ur='\e[42;30mUP\e[0m' || ur='\e[41;30mDN\e[0m' exec 6<>/dev/tcp/192.168.2.11/8080 && ut='\e[42;30mUP\e[0m' || ut='\e[41;30mDN\e[0m' exec 6<>/dev/tcp/192.168.2.11/8081 && sb='\e[42;30mUP\e[0m' || sb='\e[41;30mDN\e[0m' exec 6<>/dev/tcp/192.168.2.11/8082 && ch='\e[42;30mUP\e[0m' || ch='\e[41;30mDN\e[0m' exec 6<>/dev/tcp/192.168.2.12/32400 && px='\e[42;30mUP\e[0m' || px='\e[41;30mDN\e[0m' #exec 6<>/dev/tcp/192.168.2.14/64738 && mb='\e[42;30mUP\e[0m' || mb='\e[41;30mDN\e[0m' exec 6<>/dev/tcp/192.168.2.14/25565 && mc='\e[42;30mUP\e[0m' || mc='\e[41;30mDN\e[0m' exec 6<>/dev/tcp/192.168.2.13/80 && ws='\e[42;30mUP\e[0m' || ws='\e[41;30mDN\e[0m' mb='\e[42;30mUP\e[0m' cleanur=$(echo $ur | sed 's/^.........\(.*\).....$/\1/') cleanut=$(echo $ut | sed 's/^.........\(.*\).....$/\1/') cleansb=$(echo $sb | sed 's/^.........\(.*\).....$/\1/') cleanch=$(echo $ch | sed 's/^.........\(.*\).....$/\1/') cleanpx=$(echo $px | sed 's/^.........\(.*\).....$/\1/') cleanmb=$(echo $mb | sed 's/^.........\(.*\).....$/\1/') cleanmc=$(echo $mc | sed 's/^.........\(.*\).....$/\1/') cleanws=$(echo $ws | sed 's/^.........\(.*\).....$/\1/') hddname=`awk -F "=" '$1 ~ /name/{print $2}' /usr/local/emhttp/state/disks.ini` hddnamearr=(${hddname//[\"-._]/}) device=`awk -F "=" '$1 ~ /device/{print $2}' /usr/local/emhttp/state/disks.ini` devicearr=(${device//[\"-._]/}) temp=`awk -F "=" '$1 ~ /temp/{print $2}' /usr/local/emhttp/state/disks.ini` temparr=(${temp//[\"-._]/}) if [ $ur = "\e[41;30mDN\e[0m" ] || [ $ut = "\e[41;30mDN\e[0m" ] || [ $sb = "\e[41;30mDN\e[0m" ] || [ $ch = "\e[41;30mDN\e[0m" ] || [ $px = "\e[41;30mDN\e[0m" ] || [ $mb = "\e[41;30mDN\e[0m" ] || [ $mc = "\e[41;30mDN\e[0m" ] || [ $ws = "\e[41;30mDN\e[0m" ] && [ $nospamphone -lt "1" ]; then nospamphone=$(($nospamphone + 1)) && curl "http://textbelt.com/text" -d number=$pnumber -d "message=Server Status Update \ unRAID=$cleanur ~~ uTorrent=$cleanut SickBeard=$cleansb ~~ CouchPotato=$cleanch Plex=$cleanpx ~~ Mumble=$cleanmb MineCraft=$cleanmc ~~ WebServer=$cleanws" echo "i sent one" sleep 5 fi if [ $ur = "\e[42;30mUP\e[0m" ] && [ $ut = "\e[42;30mUP\e[0m" ] && [ $sb = "\e[42;30mUP\e[0m" ] && [ $ch = "\e[42;30mUP\e[0m" ] && [ $px = "\e[42;30mUP\e[0m" ] && [ $mb = "\e[42;30mUP\e[0m" ] && [ $mc = "\e[42;30mUP\e[0m" ] && [ $ws = "\e[42;30mUP\e[0m" ] && [ $nospamphone -gt "0" ]; then nospamphone=0 && curl "http://textbelt.com/text" -d number=$pnumber -d "message=Server Status Update \ Back Online and Operational" fi clear if [[ ${#temparr[0]} -gt '1' ]] ; then if [ ${temparr[0]} -lt "41" ]; then hddtemp0='\e[42;30m'${devicearr[0]}' '${temparr[0]}c'\e[0m' else hddtemp0='\e[41;30m'HOT' '${temparr[0]}c'\e[0m' fi else hddtemp0='\e[42;30mUNK **c\e[0m' fi if [[ ${#temparr[1]} -gt '1' ]] ; then if [ ${temparr[1]} -lt "41" ]; then hddtemp1='\e[42;30m'${devicearr[1]}' '${temparr[1]}c'\e[0m' else hddtemp1='\e[41;30m'HOT' '${temparr[1]}c'\e[0m' fi else hddtemp1='\e[42;30mUNK **c\e[0m' fi if [[ ${#temparr[2]} -gt '1' ]] ; then if [ ${temparr[2]} -lt "41" ]; then hddtemp2='\e[42;30m'${devicearr[3]}' '${temparr[2]}c'\e[0m' else hddtemp2='\e[41;30m'HOT' '${temparr[2]}c'\e[0m' fi else hddtemp2='\e[42;30mUNK **c\e[0m' fi if [[ ${#temparr[3]} -gt '1' ]] ; then if [ ${temparr[3]} -lt "41" ]; then hddtemp3='\e[42;30m'${devicearr[5]}' '${temparr[3]}c'\e[0m' else hddtemp3='\e[41;30m'HOT' '${temparr[3]}c'\e[0m' fi else hddtemp3='\e[42;30mUNK **c\e[0m' fi if [[ ${#temparr[4]} -gt '1' ]] ; then if [ ${temparr[4]} -lt "41" ]; then hddtemp4='\e[42;30m'${devicearr[7]}' '${temparr[4]}c'\e[0m' else hddtemp4='\e[41;30m'HOT' '${temparr[4]}c'\e[0m' fi else hddtemp4='\e[42;30mUNK **c\e[0m' fi if [[ ${#temparr[5]} -gt '1' ]] ; then if [ ${temparr[5]} -lt "41" ]; then hddtemp5='\e[42;30m'${devicearr[9]}' '${temparr[5]}c'\e[0m' else hddtemp5='\e[41;30m'HOT' '${temparr[5]}c'\e[0m' fi else hddtemp5='\e[42;30mUNK **c\e[0m' fi if [[ ${#temparr[6]} -gt '1' ]] ; then if [ ${temparr[6]} -lt "41" ]; then hddtemp6='\e[42;30m'${devicearr[11]}' '${temparr[6]}c'\e[0m' else hddtemp6='\e[41;30m'HOT' '${temparr[6]}c'\e[0m' fi else hddtemp6='\e[42;30mUNK **c\e[0m' fi echo -e " \e[1;34m:\e[0m\e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;31m=====\e[0m \e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;37m:\e[0m\e[1;31m====\e[0m \e[1;34m:\e[0m\e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;31m====\e[0m \e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;37m:\e[0m\e[1;31m====\e[0m \e[1;34m:\e[0m\e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;31m===\e[0m " echo -e " \e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;37m:\e[0m \e[1;34m:\e[0m\e[1;37m:\e[1;34m:\e[0m \e[1;37m===\e[0m \e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;37m:\e[0m \e[1;37m===\e[0m \e[1;34m:\e[0m\e[1;37m:\e[0m\e[1;34m:\e[0m \e[1;37m===\e[0m \e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;37m:\e[0m " echo -e " \e[1;31m=== === === ======= ======= =====\e[0m " echo -e " \e[1;37m=== === === === === === ===\e[0m " echo -e " \e[1;31m=======\e[0m \e[1;32m=\e[0m \e[1;31m======\e[0m \e[1;32m=\e[0m \e[1;31m=== ===\e[0m \e[1;32m=\e[0m \e[1;31m===\e[0m \e[1;32m=\e[0m \e[1;31m======\e[0m " echo -e " Combined Operations in Rack Portable Storage uptime: $uptime Days " echo -e " " echo -e " VM Resource Pool Application Status " echo -e " *------------------------------* *-------------------* " echo -e " | unRaid vCPU 1 / 1810 MEM | | unRAID: $ur | " echo -e " | Windows8_R vCPU 7 / 2045 MEM | | Plex: $px | " echo -e " | Windows8_G vCPU 3 / 3072 MEM | | SickBeard: $sb | " echo -e " | Tkey vCPU 1 / 768 MEM | | CouchPotato: $ch | " echo -e " *------------------------------* | uTorrent: $ut | " echo -e " Raid Space | Mumble $mb | " echo -e " *------------------------------* | MC Server $mc | " echo -e " | $hdspacefree Free / $hdspacetot Total | | WebServer $ws | " echo -e " *------------------------------* *-------------------* " echo -e " _______ _______ _______ _______ _______ _______ _______ _______ " echo -e " |$hddtemp0| |$hddtemp1| |$hddtemp2| |$hddtemp3| |$hddtemp4| |$hddtemp5| |$hddtemp6| |\e[42;30m${devicearr[13]} **c\e[0m|" echo -e " | o. | | o. | | o. | | o. | | o. | | o. | | o. | | o. |" echo -e " |___O___| |___O___| |___O___| |___O___| |___O___| |___O___| |___O___| |___O___|" echo -e " ${hddnamearr[0]} ${hddnamearr[1]} ${hddnamearr[2]} ${hddnamearr[3]} ${hddnamearr[4]} ${hddnamearr[5]} ${hddnamearr[6]} ${hddnamearr[7]}" sleep 60 done Ouputs: :::===== :::==== :::==== :::==== :::=== ::: ::: === ::: === ::: === ::: === === === ======= ======= ===== === === === === === === === ======= = ====== = === === = === = ====== Combined Operations in Rack Portable Storage uptime: 1 Days VM Resource Pool Application Status *------------------------------* *-------------------* | unRaid vCPU 1 / 1810 MEM | | unRAID: UP | | Windows8_R vCPU 7 / 2045 MEM | | Plex: UP | | Windows8_G vCPU 3 / 3072 MEM | | SickBeard: UP | | Tkey vCPU 1 / 768 MEM | | CouchPotato: UP | *------------------------------* | uTorrent: UP | Raid Space | Mumble UP | *------------------------------* | MC Server UP | | 4.5T Free / 14T Total | | WebServer UP | *------------------------------* *-------------------* _______ _______ _______ _______ _______ _______ _______ _______ |sdg 31c| |sde 32c| |sdd 32c| |sdh 32c| |sdc 33c| |sdb 33c| |UNK **c| |sda **c| | o. | | o. | | o. | | o. | | o. | | o. | | o. | | o. | |___O___| |___O___| |___O___| |___O___| |___O___| |___O___| |___O___| |___O___| parity disk1 disk2 disk3 disk4 disk5 cache flash I Feel like i need to "close" the ini file hddname=`awk -F "=" '$1 ~ /name/{print $2}' /usr/local/emhttp/state/disks.ini` hddnamearr=(${hddname//[\"-._]/})
June 22, 201412 yr emhttp needs to update those values. Try making a request to http://ipaddress/update.htm before hand. If that doesn't work, do a request to http://ipaddress/main.
Archived
This topic is now archived and is closed to further replies.