Custom Tools Directory

Status
Not open for further replies.

NASbox

Guru
Joined
May 8, 2012
Messages
650
On my FreeNAS 8.3.1 I'm a UDF Flash Drive to house my custom maintenance scripts so that they are totally independent of my data pools.

I just upgraded to FreeNAS v11U4, so using a UDF Flash Drive is no longer an option. I am now using a 120GB SSD as a boot drive, so I was wondering if there is any way to save my tools directory on the boot drive (so that it doesn't get overwritten)?

If not, is a ZFS flash drive still a viable option? (My UDF drive was in service for over 4 years without incident-almost no write access).

If I'm stuck with a Flash Drive, what's the best way to configure it?

I assume that it would be best to exclude a swap area.

What about having 2 copies on the same drive? Clearly wouldn't prevent a complete hardware failure, but would it give more time to recover in the event of a bad sector.

Any comments/suggestions from someone who knows their way around this hardware would be much appreciated.

Thanks.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Suggestion, possibly do things differently. Think about this:
I keep all my utility scripts in a directory on the storage pool and just copy them back to the scripts directory I created in the rare event that they get erased in an update. I created my scripts directory under the root directory and it has not been a problem as far as being erased for me except when I went from the FreeNAS 9.10 series to the FreeNAS 11 series because I had to do a full install instead of an upgrade.
It is really easy to just copy the files back from the zpool so I don't see a reason to use external storage, unless you just want a backup. The other nice thing about the way I am doing it, I can access the scripts from my desktop to edit them because they are in the portion of the directory structure that is shared to the network. Then I just SSH into the server and copy the updated scripts back to the scripts directory. Never need to touch the server except via the network and the script can be on my desktop and on the zpool and in the scripts folder.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Suggestion, possibly do things differently. Think about this:
I keep all my utility scripts in a directory on the storage pool and just copy them back to the scripts directory I created in the rare event that they get erased in an update. I created my scripts directory under the root directory and it has not been a problem as far as being erased for me except when I went from the FreeNAS 9.10 series to the FreeNAS 11 series because I had to do a full install instead of an upgrade.
It is really easy to just copy the files back from the zpool so I don't see a reason to use external storage, unless you just want a backup. The other nice thing about the way I am doing it, I can access the scripts from my desktop to edit them because they are in the portion of the directory structure that is shared to the network. Then I just SSH into the server and copy the updated scripts back to the scripts directory. Never need to touch the server except via the network and the script can be on my desktop and on the zpool and in the scripts folder.

That's a good idea!

So if I call my directory /custom, I assume there is no problem adding this to the PATH for ssh logon, or using that path for a cron job - correct?
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
That's a good idea!

So if I call my directory /custom, I assume there is no problem adding this to the PATH for ssh logon, or using that path for a cron job - correct?
I used the path
Code:
/root/scripts
and it has been working for me. I don't know if making it directly at / would work.
I didn't need to change anything.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
I was just poking about, and I noticed that a lot of the directories have permission of 644/755... just wondering if it needs to be that way, or if 640/750 is acceptable.

freenas# ls -la /root
total 75
drwxr-xr-x 3 root wheel 14 Oct 15 00:09 .
drwxr-xr-x 19 root wheel 26 Oct 15 23:52 ..
-rw------- 1 root wheel 152 Oct 9 00:56 .bash_history
-rw-r--r-- 1 root wheel 1128 Sep 29 02:04 .bashrc
-rw-r--r-- 2 root wheel 887 Sep 29 02:04 .cshrc
-rw-r--r-- 1 root wheel 97 Sep 29 02:04 .gdbinit
-rw------- 1 root wheel 424 Sep 20 22:42 .history
-rw-r--r-- 1 root wheel 80 Sep 29 02:04 .k5login
-rw------- 1 root wheel 112 Oct 15 00:09 .lesshst
-rw-r--r-- 1 root wheel 82 Sep 29 02:04 .login
-rw-r--r-- 1 root wheel 559 Sep 29 02:04 .profile
-rw-r--r-- 1 root wheel 1128 Sep 29 02:04 .shrc
drwxr-xr-x 2 root wheel 2 Sep 19 21:22 .ssh
-rw------- 1 root wheel 16384 Sep 20 02:50 secrets.tdb
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
I set permissions on the individual script files that I wanted to run to 755, but I didn't change permissions on any of the directories, not even the new one I created. I just did my mkdir scripts and started creating my script files with touch and then went back through and chmod 0755 on each script.
I run most of my scripts through cron and a few from the command line when I need to. In those cases, when I SSH in, I just change directory cd scriptsand run the file I want like ./get_hdd_temp.sh on the occasion that I actually need it.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
I was just poking about, and I noticed that a lot of the directories have permission of 644/755... just wondering if it needs to be that way, or if 640/750 is acceptable.
I would suggest not changing anything you don't explicitly need to change. Just create a new subdirectory for your files and leave the rest the way it is.
Most of what you listed are config files.
 
Status
Not open for further replies.
Top