HeavyScript Setup

Last Edit: 2023.12.10

Overview

HeavyScript installation and setup for TrueNAS management.

Assumptions

Install HeavyScript

HeavyScript is a bash tool for automating TrueNAS Scale application management. It is recommended in the TrueCharts documentation, but is not required when using TrueCharts. Refer to the HeavyScript GitHub repository for more information.

Deploy

HeavyScript is not a TrueNAS or TrueCharts application, it must be installed from terminal. Open a shell session on your server: System Settings - Shell.

Review the HeavyScript deploy script on GitHub. The HeavyScript one line installation can be completed using curl.

curl -s https://raw.githubusercontent.com/Heavybullets8/heavy_script/main/functions/deploy.sh | bash && source "$HOME/.bashrc" 2>/dev/null && source "$HOME/.zshrc" 2>/dev/null

Schedule

Schedule HeavyScript to run with a cron job.

Command

HeavyScript command to update system applications. Can be configured with multiple flags, refer to the project repository for a full flag list.

Basic update command, use this when configuring with a config.ini file.

bash /root/heavy_script/heavy_script.sh update

Update command with flags, set to ignore config.ini file.

bash /root/heavy_script/heavy_script.sh update --backup 14 --concurrent 5 --no-config --prune --rollback --sync --self-update
FlagDescription
--backup 14Create backup and keep specified number of backups.
--concurrent 5How many applications to update at once.
--pruneRemove unused images after updates.
--no-configIgnore the config.ini file. This will use defaults unless a value is specified with a flag. Remove this to use config.ini for configuration.
--rollbackRollback to previous version if update fails.
--syncSync catalogs.
--self-updateUpdate HeavyScript.

Cron Job

Schedule a cron job on the TrueNAS system in advanced settings. Navigate to System Settings - Advanced and locate the Cron Jobs section.

Select Add to add a new cron job, read the warning provided by TrueNAS. Configure it as detailed, modify the command as necessary for the system.

SettingValueDescription
DescriptionHeavyScriptCron job description when viewing in the administrative interface.
CommandHEAVYSCRIPT_COMMANDHeavyScript command to execute when scheduled. Modify to flags as required.
Run As UserrootUser to execute the cron job as. HeavyScript requires being the root user to function.
Schedule(0 5 * * *)When to run the cron job. This value will run the the job at 5:00 AM every day.
Hide Standard OutputfalseWhen false, standard output will be sent to the executing user.
Hide Standard ErrorfalseWhen false, error output will be sent to the executing user.
EnabledtrueRun state of the cron job.

HeavyScript cron job in TrueNAS advanced system settings.

Save the cron job and optionally Run Now to verify it works as intended.

Configure HeavyScript

The configuration file is created when the script is first executed. Run the script once before attempting to modify its settings.

When using the config.ini for configuring HeavyScript, remove the --no-config flag from the cron job command.

nano /root/heavy_script/config.ini

References

1 2 3