smart testing of pool drives no longer working

Status
Not open for further replies.

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Yep, given the advantages I think it's worth it :)

No permission problems, no owner problems, not exposed to clients, well isolated from the other things (so no risks of accidental deletion and others fun things like that), ...


Eh, give me a few minutes to answer :P
 

Daniel Dande

Dabbler
Joined
Sep 3, 2015
Messages
13
Perfect.

So now you just need to follow this:

Maximize your SSH window if it wasn't already maximized (to avoid breaking long lines in the script when you'll paste it).

Go to your pool (you can go to a dataset in the pool if you want, just avoid a dataset where the script can bother you on the client side): cd /mnt/your_pool/

Then create a directory (if you want) to put your scripts in: mkdir scripts

Go in this directory if you created it (cd scripts) and open a new a file: nano your_script.sh

Copy the raw paste data of the script on pastebin (at the bottom of the page), be careful to not forget the first or last line, the best thing to do is to click on the text, do a Ctrl + A and then a Ctrl + C.

Paste the data in the file you created by right-clicking (on the UNIX systems if you highlight something it'll be copied to the clipboard and if you middle-click (right-click on Putty) you'll paste whatever is currently in the clipboard).

Check rapidly that everything is as it should, do the changes you want to make (email address, ...) then save and quit the editor (for nano: Ctrl + O then Enter, and then Ctrl + X).

Add execution rights to the file: chmod +x your_script.sh

Now you should have a working script, you can test it like this: ./your_script.sh

Please note that several (all?) of my scripts needs root rights so use the root account to execute them (but as you've SSH'ed with the root account it shouldn't be a problem).

Once you tested that everything works as it should you can add a CRON task in the web GUI if you want to execute the script regularly. Make sure you select "root" as the user and use the absolute path to your script as the command (for example: /mnt/your_pool/scripts/your_script.sh).

As a new comer to FreeNAS I'd like to ask what is the recommended place for the scripts if I'd like to store them on my boot drive?
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
I'd say /root/ (it's best to make a subdirectory "/root/scripts/" for example) but to a newcomer I'd say it's best to make a dataset "scripts" (I finally done that myself as I had to re-install anyway) which is then accessible at /mnt/your_pool/scripts/ ;)
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
No problem, you're welcome ;)
 
Status
Not open for further replies.
Top