(408) 943-4100               V   Commercial Support Toggle between Light and Dark mode

Init/Shutdown Scripts

  2 minute read.

Last Modified 2021-07-30 09:07 EDT

TrueNAS can schedule commands or scripts to run at system startup or shutdown. To create a new script, go to Tasks > Init/Shutdown Scripts and click ADD.


Init/Shutdown Script

DescriptionComments about this script.
TypeSelect Command for an executable or Script for an executable script.
CommandEnter the command with any options. When Script is selected, click the to define the path to the script file.
WhenPre 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. Shutdown is during the system power off process.
EnabledEnable this task. Unset to disable the task without deleting it.
TimeoutAutomatically stop the script or command after the specified seconds.

You can also include the full path to a command in the entry. Scheduled commands must be in the default path. The path can be tested with which {COMMAND} in the Shell. When available, the path to the command is shown:

[root@freenas ~]# which ls
Always test the script first to verify it is executable and achieves the desired results. All init/shutdown scripts are run with sh.

All saved Init/Shutdown tasks are shown in Tasks > Init/Shutdown Scripts. Click (Options) next to a task to EDIT or DELETE that task.