Thousandbuckle
Contributor
- Joined
- Jul 9, 2014
- Messages
- 136
Hello all, I have found that I can run a command through the FreeNAS shell in the webgui but doing the same command through Putty ssh connection to FreeNAS box I get error. What would be the reason for getting the different results from the Shell vs Other SSH programs? What is the best way to connect to FreeNAS box outside of using the built in shell?
The command I am issuing is the text below.
[root@FreeNAS ~]# #! /bin/sh
[root@FreeNAS ~]# echo "CPU temp :"
CPU temp :
[root@FreeNAS ~]# sysctl -a |egrep -E "cpu\.[0-9]+\.temp"
dev.cpu.3.temperature: 42.0C
dev.cpu.2.temperature: 44.0C
dev.cpu.1.temperature: 43.0C
dev.cpu.0.temperature: 45.0C
[root@FreeNAS ~]# echo
[root@FreeNAS ~]# echo "HDD temp :"
HDD temp :
[root@FreeNAS ~]# for i in $(sysctl -n kern.disks)
> do
> DevTemp=`smartctl -a /dev/$i | awk '/Temperature_Celsius/{print $0}' | awk '{print $10 "C"}'`
> DevSerNum=`smartctl -a /dev/$i | awk '/Serial Number:/{print $0}' | awk '{print $3}'`
> DevName=`smartctl -a /dev/$i | awk '/Device Model:/{print $0}' | awk '{print $3}'`
> echo $i $DevTemp $DevSerNum $DevName
> done
da0
ada3 36C WD-WCC4M0083526 WDC
ada2 36C WD-WCC4M0087224 WDC
ada1 32C WD-WCC4M0097463 WDC
ada0 33C WD-WCC4M0099604 WDC
If I use Putty SSH connection I get a partial success for CPU but for HD I get some kind of issue/error the red text below. If I hit enter it keeps scrolling pages of the numeric values in red listed below:
[root@FreeNAS] ~# #! /bin/sh
#!: Command not found.
[root@FreeNAS] ~# echo "CPU temp :"
CPU temp :
[root@FreeNAS] ~# sysctl -a |egrep -E "cpu\.[0-9]+\.temp"
dev.cpu.3.temperature: 43.0C
dev.cpu.2.temperature: 44.0C
dev.cpu.1.temperature: 48.0C
dev.cpu.0.temperature: 43.0C
[root@FreeNAS] ~# echo
[root@FreeNAS] ~# echo "HDD temp :"
HDD temp :
[root@FreeNAS] ~# for i in $(sysctl -n kern.disks)
Illegal variable name.
[root@FreeNAS] ~# do
CORRECT>od (y|n|e|a)? yes
0000000 020040 020040 020040 042040 073145 062524 070155 060075
0000020 066563 071141 061564 066164 026440 020141 062057 073145
0000040 022057 020151 020174 073541 020153 027447 062524 070155
The command I am issuing is the text below.
- #! /bin/sh
- echo "CPU temp :"
- sysctl -a |egrep -E "cpu\.[0-9]+\.temp"
- echo
- echo "HDD temp :"
- for i in $(sysctl -n kern.disks)
- do
- DevTemp=`smartctl -a /dev/$i | awk '/Temperature_Celsius/{print $0}' | awk '{print $10 "C"}'`
- DevSerNum=`smartctl -a /dev/$i | awk '/Serial Number:/{print $0}' | awk '{print $3}'`
- DevName=`smartctl -a /dev/$i | awk '/Device Model:/{print $0}' | awk '{print $3}'`
- echo $i $DevTemp $DevSerNum $DevName
- done
[root@FreeNAS ~]# #! /bin/sh
[root@FreeNAS ~]# echo "CPU temp :"
CPU temp :
[root@FreeNAS ~]# sysctl -a |egrep -E "cpu\.[0-9]+\.temp"
dev.cpu.3.temperature: 42.0C
dev.cpu.2.temperature: 44.0C
dev.cpu.1.temperature: 43.0C
dev.cpu.0.temperature: 45.0C
[root@FreeNAS ~]# echo
[root@FreeNAS ~]# echo "HDD temp :"
HDD temp :
[root@FreeNAS ~]# for i in $(sysctl -n kern.disks)
> do
> DevTemp=`smartctl -a /dev/$i | awk '/Temperature_Celsius/{print $0}' | awk '{print $10 "C"}'`
> DevSerNum=`smartctl -a /dev/$i | awk '/Serial Number:/{print $0}' | awk '{print $3}'`
> DevName=`smartctl -a /dev/$i | awk '/Device Model:/{print $0}' | awk '{print $3}'`
> echo $i $DevTemp $DevSerNum $DevName
> done
da0
ada3 36C WD-WCC4M0083526 WDC
ada2 36C WD-WCC4M0087224 WDC
ada1 32C WD-WCC4M0097463 WDC
ada0 33C WD-WCC4M0099604 WDC
If I use Putty SSH connection I get a partial success for CPU but for HD I get some kind of issue/error the red text below. If I hit enter it keeps scrolling pages of the numeric values in red listed below:
[root@FreeNAS] ~# #! /bin/sh
#!: Command not found.
[root@FreeNAS] ~# echo "CPU temp :"
CPU temp :
[root@FreeNAS] ~# sysctl -a |egrep -E "cpu\.[0-9]+\.temp"
dev.cpu.3.temperature: 43.0C
dev.cpu.2.temperature: 44.0C
dev.cpu.1.temperature: 48.0C
dev.cpu.0.temperature: 43.0C
[root@FreeNAS] ~# echo
[root@FreeNAS] ~# echo "HDD temp :"
HDD temp :
[root@FreeNAS] ~# for i in $(sysctl -n kern.disks)
Illegal variable name.
[root@FreeNAS] ~# do
CORRECT>od (y|n|e|a)? yes
0000000 020040 020040 020040 042040 073145 062524 070155 060075
0000020 066563 071141 061564 066164 026440 020141 062057 073145
0000040 022057 020151 020174 073541 020153 027447 062524 070155