Skip to content

PlqnK/truenas-useful-scripts

Repository files navigation

TrueNAS Useful Scripts

Disclaimer

These scripts are based on TrueNAS forums user Bidule0hm scripts which are themselves based on TrueNAS forums user joeschmuck scripts and TrueNAS forums user titan_rw scripts. Though I still did a lot of work, like rewriting large parts of them and doing some overall code cleaning.

About the project

This is a collection of useful scripts for TrueNAS admins that want to have more reporting than just what's included in the OS, display useful information like HDD and CPU temperature easily in a terminal and scripting the backup of the TrueNAS config.

Roadmap

  • Change how SMART and zpool reports are displayed in order to use native HTML tables.
  • Take some ideas from Spearfoot FreeNAS scripts, in particular the encryption (but using GPG instead of a symetric algorithm like AES256) and sending of a correctly MIME-formated config backup as an email attachment.
  • Add GitHub actions to lint the scripts.

Prerequisites

  • TrueNAS 12.0+

For FreeNAS 11.3 support see the v1.0.0 release/tag

Installation

git clone https://github.com/PlqnK/truenas-useful-scripts.git
cd truenas-useful-scripts
for file in *.example*; do cp $file $(echo $file | sed -e 's/.example//'); done

You then need to adapt the variables in the user.conf file according to your setup and needs.

Next, set the scripts as executable:

find . -type f -name "*.sh" -exec chmod +x {} \;

Finally you will need to create cron jobs in the TrueNAS WebUI in order to execute the reporting and backup script on a schedule. The TrueNAS documentation explains how to do it. The command to execute should be:

/path/to/the/script.sh

Contributing

Contributions in the form of issues or PR are welcome if you see any area of improvement or if you have new ideas for useful scripts!

This project is following Google Shell style guidelines and translate-shell AWK style guidelines but I prefer to keep AWK usage to a minimum, only when there's no really usable bash alternative.

License

This project is released under the BSD 3-Clause License. A copy of the license is available in this project folder.