Init commit
This commit is contained in:
parent
4f6a7bc72f
commit
9ffffcd854
21
README.md
21
README.md
@ -1,2 +1,21 @@
|
||||
# TrueNAS_change_arc_size
|
||||
Simple script for checking if arc size was changed.
|
||||
Script for checking if arc size was changed, and changing it back.
|
||||
|
||||
|
||||
## Usage
|
||||
Set **arc_check.sh** file to run with cron, InitScript or both.
|
||||
|
||||
In **arc_check.sh** change ***<CHANGE_ME>*** value to match the size you want. For converting GiB to bytes I've used [this site](https://www.dataunitconverter.com/gibibyte-to-byte).
|
||||
|
||||
|
||||
### Crontab
|
||||
**1>** redirects stdout to /tmp/arc_size.log
|
||||
|
||||
**2>** stderr to /tmp/arc_size.errlog
|
||||
|
||||
<_cronexpression_> /dir/to/file/arc_check.sh 1> /tmp/arc_size.log 2> /tmp/arc_size.errlog
|
||||
|
||||
|
||||
### InitScript
|
||||
|
||||
You can configure it in TrueNAS GUI under System Settings > Advanced > Init/Shutdown Scripts
|
21
arc_check.sh
Normal file
21
arc_check.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/zsh
|
||||
|
||||
arc_size=$(cat "/sys/module/zfs/parameters/zfs_arc_max")
|
||||
|
||||
target_arc_size="<CHANGE_ME>" # GiB to bytes | ex. 24GiB = 25769803776
|
||||
|
||||
if [[ -z $arc_size || $arc_size -eq "0" || $arc_size -lt "0" ]]
|
||||
then
|
||||
echo "<CHANGE_ME>" >> /sys/module/zfs/parameters/zfs_arc_max
|
||||
echo "Arc size changed!"
|
||||
exit 1
|
||||
|
||||
elif [[ $arc_size = $target_arc_size ]]
|
||||
then
|
||||
echo "Arc size is set properly."
|
||||
exit 0
|
||||
|
||||
else
|
||||
echo "Unknown state!"
|
||||
exit 1
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user