Skip to content

Commit cff8558

Browse files
authored
Merge pull request #7 from PlqnK/migrate-to-truenas-12
Update scripts to support TrueNAS 12
2 parents 999bea9 + 9dd062f commit cff8558

11 files changed

+49
-25
lines changed

.markdownlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
---
22
MD013: false
3+
MD024: false

CHANGELOG.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
## [2.0.0] - 2020-11-02
10+
11+
Initial release with support for TrueNAS 12 🎉
12+
13+
### Added
14+
15+
- Add a Markdown Lint job to the Lint action
16+
- Add a Release action to create a GitHub release on git tags with a changelog
17+
18+
### Changed
19+
20+
- Rename repository to "TrueNAS Useful Scripts"
21+
- Change GitHub URL to <https://github.com/PlqnK/truenas-useful-scripts>
22+
- Replace every "FreeNAS" references in the readme and scripts to "TrueNAS" where applicable
23+
24+
### Fixed
25+
26+
- Fix `zpool status` output parsing in the ZPool report script
27+
- Fix ShellCheck action (follow sourced scripts)
28+
929
## [1.0.0] - 2020-11-02
1030

1131
Final release supporting FreeNAS 11.3!
@@ -17,5 +37,6 @@ Final release supporting FreeNAS 11.3!
1737
- 2 information gathering script (CPU & drives temperature as well as drives identification)
1838
- A standalone bash function to format emails to be sent by the FreeNAS sendmail program
1939

20-
[Unreleased]: https://github.com/PlqnK/freenas-useful-scripts/compare/v1.0.0...HEAD
21-
[1.0.0]: https://github.com/PlqnK/freenas-useful-scripts/releases/tag/v1.0.0
40+
[Unreleased]: https://github.com/PlqnK/truenas-useful-scripts/compare/v2.0.0...HEAD
41+
[2.0.0]: https://github.com/PlqnK/truenas-useful-scripts/compare/v1.0.0...v2.0.0
42+
[1.0.0]: https://github.com/PlqnK/truenas-useful-scripts/releases/tag/v1.0.0

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2019, Victor Bouvier-Deleau
3+
Copyright (c) 2019-2020, Victor Bouvier-Deleau
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# FreeNAS Useful Scripts
1+
# TrueNAS Useful Scripts
22

33
## Disclaimer
44

5-
These scripts are based on [FreeNAS forums user Bidule0hm scripts](https://forums.freenas.org/index.php?threads/scripts-to-report-smart-zpool-and-ups-status-hdd-cpu-t%C2%B0-hdd-identification-and-backup-the-config.27365/) which are themselves based on [FreeNAS forums user joeschmuck scripts](https://forums.freenas.org/index.php?threads/set-up-smart-reporting-via-email.6211/) and [FreeNAS forums user titan_rw scripts](https://forums.freenas.org/index.php?threads/set-up-smart-reporting-via-email.6211/). Though I still did a lot of work, like rewriting large parts of them and doing some overall code cleaning.
5+
These scripts are based on [TrueNAS forums user Bidule0hm scripts](https://www.truenas.com/community/threads/scripts-to-report-smart-zpool-and-ups-status-hdd-cpu-t%C2%B0-hdd-identification-and-backup-the-config.27365/) which are themselves based on [TrueNAS forums user joeschmuck scripts](https://www.truenas.com/community/threads/set-up-smart-reporting-via-email.6211/) and [TrueNAS forums user titan_rw scripts](https://www.truenas.com/community/threads/set-up-smart-reporting-via-email.6211/). Though I still did a lot of work, like rewriting large parts of them and doing some overall code cleaning.
66

77
## About the project
88

9-
This is a collection of useful scripts for FreeNAS 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 FreeNAS config.
9+
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.
1010

1111
## Roadmap
1212

@@ -16,13 +16,15 @@ This is a collection of useful scripts for FreeNAS admins that want to have more
1616

1717
## Prerequisites
1818

19-
- FreeNAS (tested with version 11.2+)
19+
- TrueNAS 12.0+
20+
21+
> For FreeNAS 11.3 support see the `v1.0.0` release/tag
2022
2123
## Installation
2224

2325
```bash
24-
git clone https://github.com/PlqnK/freenas-useful-scripts.git
25-
cd freenas-useful-scripts
26+
git clone https://github.com/PlqnK/truenas-useful-scripts.git
27+
cd truenas-useful-scripts
2628
for file in *.example*; do cp $file $(echo $file | sed -e 's/.example//'); done
2729
```
2830

@@ -34,7 +36,7 @@ Next, set the scripts as executable:
3436
find . -type f -name "*.sh" -exec chmod +x {} \;
3537
```
3638

37-
Finally you will need to create cron jobs in the FreeNAS WebUI in order to execute the reporting and backup script on a schedule. [The FreeNAS documentation explains how to do it.](https://www.ixsystems.com/documentation/freenas/11.2/tasks.html#cron-jobs) The command to execute should be:
39+
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.](https://www.truenas.com/docs/hub/tasks/scheduled/cron-jobs/) The command to execute should be:
3840

3941
```sh
4042
/path/to/the/script.sh

config_backup.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Send a FreeNAS config backup via Email and also store it somewhere in a data pool.
3+
# Send a TrueNAS config backup via Email and also store it somewhere in a data pool.
44

55
readonly SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
66

@@ -11,7 +11,7 @@ source "${SCRIPT_PATH}/global.conf"
1111
# shellcheck source=format_email.sh
1212
source "${SCRIPT_PATH}/format_email.sh"
1313

14-
readonly EMAIL_SUBJECT="FreeNAS $(hostname): Config backup"
14+
readonly EMAIL_SUBJECT="TrueNAS $(hostname): Config backup"
1515
readonly EMAIL_BODY="/tmp/config_backup.html"
1616
readonly TAR_FILE="/tmp/${BACKUP_FILE_NAME}.tar.gz"
1717

@@ -22,7 +22,7 @@ if [[ "$(sqlite3 /data/freenas-v1.db "pragma integrity_check;")" == "ok" ]]; the
2222
(
2323
# Only specify monospace font to let Email client decide of the rest.
2424
echo "<pre style=\"font-family:monospace\">"
25-
echo "<b>Automatic backup of FreeNAS config succeded!</b>"
25+
echo "<b>Automatic backup of TrueNAS config succeded!</b>"
2626
echo ""
2727
echo "You will find a compressed archive attached."
2828
echo ""
@@ -45,7 +45,7 @@ else # Send error message via Email.
4545
(
4646
# Only specify monospace font to let Email client decide of the rest.
4747
echo "<pre style=\"font-family:monospace\">"
48-
echo "<b>/!\ Automatic backup of FreeNAS config failed /!\</b>"
48+
echo "<b>/!\ Automatic backup of TrueNAS config failed /!\</b>"
4949
echo ""
5050
echo "The config file is corrupted, you should correct this problem as soon as possible."
5151
echo ""

format_email.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
#
3-
# Bash functions to format an email to be sent by the FreeNAS 'sendmail' program.
4-
# FreeNAS 'sendmail' uses a "custom" mail sending program, written in Python by the FreeNAS team.
3+
# Bash functions to format an email to be sent by the TrueNAS 'sendmail' program.
4+
# TrueNAS 'sendmail' uses a "custom" mail sending program, written in Python by the TrueNAS team.
55
# I can't make this program work with the Content-Type 'multipart/alternative'.
66
# And you are required to use the Content-Type: multipart/mixed, even when you have no attachment because the program
77
# will overwrite your other Content-Type/Transfer-Encoding if it's not set.

global.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ readonly UI_WARNING_SYMBOL="?"
1111
readonly UI_CRITICAL_SYMBOL="!"
1212

1313
# Config backup
14-
readonly BACKUP_FILE_NAME="$(hostname -s)-FreeNAS-$(uname -r)_$(date "+%Y-%m-%d_%H-%M-%S")"
14+
readonly BACKUP_FILE_NAME="$(hostname -s)-TrueNAS-$(uname -r)_$(date "+%Y-%m-%d_%H-%M-%S")"
1515

1616
# UPS report
1717
if [[ $(basename $0) == "ups_report.sh" ]]; then

smart_report.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ source "${SCRIPT_PATH}/global.conf"
1111
# shellcheck source=format_email.sh
1212
source "${SCRIPT_PATH}/format_email.sh"
1313

14-
readonly EMAIL_SUBJECT="FreeNAS $(hostname): SMART status report"
14+
readonly EMAIL_SUBJECT="TrueNAS $(hostname): SMART status report"
1515
readonly EMAIL_BODY="/tmp/smart_report.html"
1616

1717
# Only specify monospace font to let Email client decide of the rest.

ups_report.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ source "${SCRIPT_PATH}/global.conf"
1111
# shellcheck source=format_email.sh
1212
source "${SCRIPT_PATH}/format_email.sh"
1313

14-
readonly EMAIL_SUBJECT="FreeNAS $(hostname): UPS status report"
14+
readonly EMAIL_SUBJECT="TrueNAS $(hostname): UPS status report"
1515
readonly EMAIL_BODY="/tmp/ups_report.html"
1616

1717
# Only specify monospace font to let Email client decide of the rest.

user.example.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Config backup
2-
# If you don't want to store your config backup somewhere on your FreeNAS filesystem you can just leave this variable
2+
# If you don't want to store your config backup somewhere on your TrueNAS filesystem you can just leave this variable
33
# empty like: readonly BACKUP_FILE_PATH=""
4-
readonly BACKUP_FILE_PATH="/path/to/freenas/db/backup/dir"
4+
readonly BACKUP_FILE_PATH="/path/to/truenas/db/backup/dir"
55
# Change the owner of the file, leave empty ("") if not desired
66
readonly BACKUP_FILE_OWNER="myuser"
77

0 commit comments

Comments
 (0)