Create an Init/Shutdown Script TrueNAS can schedule commands or scripts to run at system startup or shutdown.
Go to Tasks > Init/Shutdown Scripts and click ADD.
Enter a Description, then select a Type.
Command Type Enter a command with any options you want. You can find commands here or on our Community Forums.
Can I use a path for the Command? You can also include the full path to a command in the entry.
Init/Shutdown Script
Name Description Description Comments about this script. Type Select Command for an executable command or Script for an executable script. Command Enter the command with any options. When Script is selected, click the folder to define the path to the script file. When Pre Init is early in the boot process, after mounting filesystems and starting networking. Post Init is at the end of the boot process, before TrueNAS services start.
Advanced settings have reasonable defaults in place. A warning message displays for some settings advising of the dangers of making changes. Changing advanced settings can be dangerous when done incorrectly. Use caution before saving changes.
Make sure you are comfortable with ZFS, Linux, and system configuration, backup, and restoration before making any changes.
The Advanced settings screen provides configuration options for the console, syslog, audit, kernel, sysctl, storage (system dataset pool), replication, WebSocket sessions, cron jobs, init/shutdown scripts, allowed IP addresses, isolated GPU device(s), self-encrypting drives, and global two-factor authentication.
The Init/Shutdown Scripts widget on the System > Advanced screen allows you to add scripts to run before or after initialization (start-up), or at shutdown. For example, creating a script to backup your system or run a systemd command before exiting and shutting down the system.
Init/shutdown scripts are capable of making OS-level changes and can be dangerous when done incorrectly. Use caution before creating script or command tasks.
Make sure you are comfortable with ZFS, Linux, and system configuration, backup, and restoration before creating and executing script tasks.
The SCALE CLI guide is a work in progress! New namespace and command documentation is continually added and maintained, so check back here often to see what is new! Init_shutdown Namespace The init_shutdown namespace has 5 commands, and is based on init/shutdown script functions found in the SCALE API and web UI. It provides access to init/shutdown script management methods through the init_shutdown namespace commands.
Init/shutdown scripts are capable of making OS-level changes and can be dangerous when done incorrectly.