1st storage server - FreeNAS!

Status
Not open for further replies.

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
When I place the code in shell

Code:
# while 1
while? ./show_cpu_temps.sh
while? ./show_hd_temps.pl
while? sleep 30
while? end


I get the error "bash: while?: command not found". Is there something I am doing wrong?

I can run the scripts using screen ./ but I can't run in Shell?

Any advice would be great :)

I suspect the issue is that you're typing "while?" In. That is a prompt.
 

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
I suspect the issue is that you're typing "while?" In. That is a prompt.

Yes I literally copy/pasted the code.

So when I open a Shell via the FreeNAS gui, and it says "root@freenas" what should I type? I can run the scripts by changing into the directory of the scripts (cd /) then ./show_hd_temps.sh for example but I feel there is an easier way?
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
Code:
while 1
./show_cpu_temps.sh
./show_hd_temps.pl
sleep 30
end


Which looks like this in the shell

Code:
# while 1
while? ./show_cpu_temps.sh
while? ./show_hd_temps.pl
while? sleep 30
while? end
 

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
Code:
while 1
./show_cpu_temps.sh
./show_hd_temps.pl
sleep 30
end


Which looks like this in the shell

Code:
# while 1
while? ./show_cpu_temps.sh
while? ./show_hd_temps.pl
while? sleep 30
while? end

So I tried inputting into Shell without the "while?" and it seems that it just hangs within the Shell. I thought it would start scrolling the cpu/hdd temps? I took a screenshot showing how I am typing it. Not sure why it is not working :(

yeLaFw0.jpg
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
Did you press return after end?
 

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
Did you press return after end?

Yes. Should I be typing each line or copy/paste works too?

Should the script start running automatically once I press return after end? This is really weird. If it helps, I am on FreeNAS 9.10

Ok, I managed to get it working. I couldn't get it to work in Shell via the FreeNAS gui but got it working via SSH (Putty).
I had to cd/ to my scripts directory then run the code.

Hope this is the correct way to execute the scripts?!
 
Last edited:

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
It's a way.

I use that inline script when I'm long term thermal testing things. Normally I just run a script directly to get the results. And then the rest of the time i just let my fan controller do its things.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Yes. Should I be typing each line or copy/paste works too?

Should the script start running automatically once I press return after end? This is really weird. If it helps, I am on FreeNAS 9.10

Ok, I managed to get it working. I couldn't get it to work in Shell via the FreeNAS gui but got it working via SSH (Putty).
I had to cd/ to my scripts directory then run the code.

Hope this is the correct way to execute the scripts?!
If you are using a Windows computer, the even better option than putty is to install Cygwin and set it up for SSH.
Here is how: https://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm#EMBSC150

The link talks about some things that are Oracle specific, or at least specific to the thing they are trying to do, but it does go over how to install and configure Cygwin. You only need to do the part in section 5.3, the rest is related to being able to SSH into the Windows computer from a remote station. I think Cygwin works great and it is better than putty all day and I have used them both, but I have used Cygwin more because it is better.
 
Last edited:

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
So I tried inputting into Shell without the "while?" and it seems that it just hangs within the Shell. I thought it would start scrolling the cpu/hdd temps? I took a screenshot showing how I am typing it. Not sure why it is not working :(
There are many things that don't work properly through the shell in the Web GUI. It is only meant to do very, very minimal work.
Your best bet is to install Cygwin. I often have three of four Cygwin terminals open with each SSHed into a different system. It is very reliable.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
Why would you want the overhead of Cygwin when PuTTY works without any major flaws?
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Why would you want the overhead of Cygwin when PuTTY works without any major flaws?
Because Cygwin works like having a Linux computer inside your Windows computer without having to run a virtual machine. It is just better. Plus, copy and paste work reliably and, last time I tried putty, that was not true and it had other problems too.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Because Cygwin works like having a Linux computer inside your Windows computer without having to run a virtual machine. It is just better. Plus, copy and paste work reliably and, last time I tried putty, that was not true and it had other problems too.
Putty for simple ssh, cygwin if you want more of a Linux environment. And if you want that just run bash on Windows because it blows cygwin out of the water.

Sent from my XT1096 using Tapatalk
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Putty for simple ssh, cygwin if you want more of a Linux environment. And if you want that just run bash on Windows because it blows cygwin out of the water.

Sent from my XT1096 using Tapatalk
No, I have bash on Windows installed, because I thought it would be great, but it doesn't work properly in every situation, especially with editors like nano. Cygwin works perfectly in every situation I have used it, including in editors, it works just like I am on a Linux system. There are a lot of things where bash on Windows acts strange with regard to how things are rendered especially when scrolling like if you make the console window big and run top or any text application that wants to keep output aligned to window size, and I blame Windows. I had Cygwin installed back when I was on Windows 7 and when I first upgraded to Windows 10, but the first time I upgraded to Win10 creators edition, I had problems with Windows and reinstalled back to the previous version. I didn't reinstall all my software right away because I have so many things. So, for a while I was using VNC to connect to a physical Linux computer and using that system, with an actual bash on Linux, to SSH into my FreeNAS system. I just put Cygwin back because I tried bash on Windows and it wasn't working and I got tired of the VNC to another computer just to run SSH.

Edited by: Joe Schmuck
 
Last edited by a moderator:

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
No, I have bash on Windows installed, because I thought it would be great, but it doesn't work properly in every situation, especially with editors like nano. Cygwin works perfectly in every situation I have used it, including in editors, it works just like I am on a Linux system. There are a lot of things where bash on Windows acts strange with regard to how things are rendered especially when scrolling like if you make the console window big and run top or any text application that wants to keep output aligned to window size, and I blame Windows. I had Cygwin installed back when I was on Windows 7 and when I first upgraded to Windows 10, but the first time I upgraded to Win10 creators edition, I had problems with Windows and reinstalled back to the previous version. I didn't reinstall all my software right away because I have so many things. So, for a while I was using VNC to connect to a physical Linux computer and using that system, with an actual bash on Linux, to SSH into my FreeNAS system. I just put Cygwin back because I tried bash on Windows and it wasn't working and I got tired of the VNC to another computer just to run SSH.
The fact is most users should just use putty when doing ssh. If they get the point that it's not working for them they can look into other options.

Edited by: Joe Schmuck
 
Last edited by a moderator:

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
It's a way.

I use that inline script when I'm long term thermal testing things. Normally I just run a script directly to get the results. And then the rest of the time i just let my fan controller do its things.

I only want to run the scripts occasionally because sometimes I want to see the actual temps. The fan controller has been doing a great job of keeping all 24 drives under 35 degrees. Only spins up slightly now and then. Besides that it is whisper quiet.

Is there another easier way to run the script for both CPU and hdd temp? At the moment I don't mind using putty and /cd into my scripts directory then running the code

If you are using a Windows computer, the even better option than putty is to install Cygwin and set it up for SSH.
Here is how: https://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm#EMBSC150

The link talks about some things that are Oracle specific, or at least specific to the thing they are trying to do, but it does go over how to install and configure Cygwin. You only need to do the part in section 5.3, the rest is related to being able to SSH into the Windows computer from a remote station. I think Cygwin works great and it is better than putty all day and I have used them both, but I have used Cygwin more because it is better.

I will look into this and give it a try over the weekend! Thanks for the suggestion :D
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
I've edited a few of the postings above to make them less aggressive.

Now that I'm posting here, I too prefer Putty for SSH purposes. I'm not poking holes in Cygwin, I've used that too many many years ago, likely never will use it again but everyone has a personal preference. For me, if it's easy to install and make work properly, that is the one I try to use for helping people out. Kind of like why I like using ee in FreeNAS as the text editor. I hate vi because it's not intuitive, but I can use it, just would rather not.
 

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
Just providing a quick update, server has been running well since the last posting here.

No issues and completely trouble free this entire time. It has even survived a couple house moves :p

I do have a question and if anyone is able to help that would be great... so, I have set up an Apple TV 4k, however I am wanting to create its own user for the FreeNAS system that only has read access. Considering I have already created my dataset and copied files to it, is this a possibility?

I have read numerous threads but to no avail. So basically I am wanting 2 users (admin & apple) with admin having complete access ie. read, write, execute and apple with read only access on the same dataset.

Note, I have already created the dataset and created the user "admin".
 
Status
Not open for further replies.
Top