# Freenas Notes

# Band-aids and Misc.

#### To restart the TN web ui when it freezes or becomes unresponsive:

- ssh into nas
- `sudo service middlewared restart`
- command might have to get repeated a few times if the restart hangs on "waiting for PID ###"

#### Getting SMB shares to work right:

The permissions seen in a mounted SMB share (on a remote device) are NOT what the literal permissions are on the TN dataset! those permissions can't be trusted, they can only be changed (for real) from the TN system itself! SMB share settings in TN are basically left at the default, with one addition in auxillary parameters:

```
inherit permissions = yes

```

This makes newly created files &amp; folders inherit the permissions structure of the parent directory. Now newly scraped contet from \*arr trackers will inherit the (correct) permissions from the parent folder, no need to worry about umask settings in the trackers themselves.

# APC UPS Setup

##### How to set up UPS monitoring via USB, for APC UPS models.

1. Plug in the USB cable (dur)
2. Edit the UPS service in TrueNas:
    
    2.1: Choose USB driver with closest match to APC UPS model, and choose correct USB device (usually something like `/dev/ugenX.X`) and set UPS name to simply `ups`
    
    2.2: DO NOT check `Remote Monitor`
    
    2.3: Add Monitor user and password, copy same info into the `extra users` section in this format (note brackets!):
    
    ```
    [{username}]
    	password = {password}
    	actions = set
    	actions = fsd
    	instcmds = all
    
    ```
    
    2.4: Set shutdown to "UPS Reaches Low Battery", set command to: `shutdown -p +1 "System is shutting down due to low UPS battery!"`
    
    2.5: DO NOT set up email alerts! (otherwise you get two sets for each event due to system alerting!)
    
    2.6: Add `MAXAGE 25` to the "Auxilary Parameters (upsd.conf)" box (prevents occasional 'connection to UPS lost' errors)
3. Enable the service!
4. Check box to auto-start service.

##### Checking UPS status and changing parameters remotely:

1. Check status of UPS (get all stats): ```
    upsc ups@localhost
    
    ```
2. List commands that can be run from the terminal for a particular UPS: ```
    upscmd -u [username] -p [password] -l ups@localhost
    
    ```
3. Run a command on a UPS: ```
    upscmd -u [username] -p [password] ups@localhost command.name.here
    
    ```

##### Typical commands:

- `test.start.battery.quick`
- `test.start.battery.deep`
- `test.start.battery.stop`
- `beeper.disable`
- `beeper.enable`