Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 2.01 KB

CreatingInitShutdownScripts.md

File metadata and controls

56 lines (39 loc) · 2.01 KB
title description weight aliases tags
Creating Init/Shutdown Scripts
Explains how to create scheduled scripts on TrueNAS CORE.
20
/core/tasks/initshutdownscripts
initshutdown
systemleveltasks

{{< toc >}}

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.

TasksInitShutdownScriptsAdd

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.

{{< expand "Can I use a path for the Command?" "v" >}} You can also include the full path to a command in the entry. Scheduled commands must be in the default path. You can test the path with which {COMMAND} in the Shell. When available, the path to the command displays:

[root@freenas ~]# which ls
/bin/ls

{{< /expand >}}

Select when you want the Command to run and fill out the rest of the fields to your needs, then click SUBMIT.

Script Type

Select the path to the Script. The Script runs using sh(1). You can find some helpful scripts on our Community Forums.

Select when you want the Script to run and fill out the rest of the fields to your needs, then click SUBMIT.

Managing an Init/Shutdown Script

{{< hint type=note >}} Always test the script to verify it executes and achieves the desired results. All init/shutdown scripts are run with sh. {{< /hint >}}

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