TrueNAS SCALETrueNAS SCALE Documentation Archive
This content follows the TrueNAS SCALE 22.12 (Bluefin) releases. Archival documentation is provided for reference only and not actively maintained.
Use the Product and Version selectors above to view content specific to different TrueNAS software or major version.

Service

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!

Service Commands

The service namespace has 10 commands and 12 child namespaces and is based on functions found in the SCALE API and web UI. It provides access to service configuration and validation methods for the 10 service commands. The 12 child namespaces have their own commands.

You can enter commands from the main CLI prompt or from the service namespace prompt.

Get_Instance Command

The get_instance command displays the id, name, and status of a service.

The get_instance command requires you to include the id option in the command string. After entering the command correctly, it returns a table with multiple outputs.

From the CLI prompt, enter:

service get_instance id=number

From the service prompt, enter:

get_instance id=number

Where:

  • number is the service id. For example, if the ssh service id is 11, enter 11.
get_instance id=11
+---------+--------------+
|      id | 11           |
| service | ssh          |
|  enable | false        |
|   state | STOPPED      |
|    pids | <empty list> |
+---------+--------------+

Query Command

The query command displays a simple overview of all services.

The query command has no additional requirements. After entering the command, it returns a table with multiple outputs.

From the CLI prompt, enter:

service query

From the service prompt, enter:

query

service> query
+----+-------------+--------+---------+--------------+
| id | service     | enable | state   | pids         |
+----+-------------+--------+---------+--------------+
| 4  | cifs        | false  | STOPPED | <empty list> |
| 6  | ftp         | false  | STOPPED | <empty list> |
| 7  | iscsitarget | false  | STOPPED | <empty list> |
| 9  | nfs         | false  | STOPPED | <empty list> |
| 10 | snmp        | false  | STOPPED | <empty list> |
| 11 | ssh         | false  | STOPPED | 98638        |
| 14 | ups         | false  | STOPPED | <empty list> |
| 18 | smartd      | false  | STOPPED | 3079         |
| 26 | glusterd    | false  | STOPPED | <empty list> |
+----+-------------+--------+---------+--------------+

Reload Command

The reload command reloads a specified service.

The reload command requires you to include the service option in the command string. After entering the command correctly, it returns either a true or false output.

From the CLI prompt, enter:

service reload service=name

From the service prompt, enter:

reload service=name

Where:

  • name is the service name. For example, enter ssh for the ssh service.

Possible states:

PropertyDescription
trueIndicates the service reloaded.
falseIndicates the service did not reload.
reload service=ssh
true

Restart Command

The restart command restarts a specified service.

The restart command requires you to include the service option in the command string. After entering the command correctly, it returns either a true or false output.

From the CLI prompt, enter:

service restart service=name

From the service prompt, enter:

restart service=name

Where:

  • name is the service name. For example, enter ssh for the ssh service.

  • Possible returns:

PropertyDescription
trueThe service restarted successfully.
falseThe service did not restart.
restart service=ssh
true

Start Command

The start command restarts a specified service.

The start command requires you to include the service option in the command string. After entering the command correctly, it returns either a true or false output.

From the CLI prompt, enter:

service start service=name

From the service prompt, enter:

start service=name

Where:

  • name is the service name. For example, enter ssh for the ssh service.

Possible returns:

PropertyDescription
trueThe service started successfully.
falseThe service did not start.
start service=ssh
true

Started Command

The started command verifies whether or not a start command succeeded for a specified service.

Possible returns:

PropertyDescription
trueThe service started successfully.
falseThe service did not start.

The started command requires you to include the service option in the command string. After entering the command correctly, it returns either a true or false output.

From the CLI prompt, enter:

service started service=name

From the service prompt, enter:

started service=name

Where:

  • name is the service name. For example, enter ssh for the ssh service.
started service=ssh
true

Started_or_Enabled Command

The started_or_enabled command displays whether or not a service starts automatically upon reboot or is running.

Possible returns:

PropertyDescription
trueThe service restarts automatically and/or is running.
falseThe service is not running, nor does start automatically.

The started_or_enabled command requires you to include the service option in the command string. After entering the command correctly, it returns either a true or false output.

From the CLI prompt, enter:

service started_or_enabled service=name

From the service prompt, enter:

started_or_enabled service=name

Where:

  • name is the service name. For example, enter ssh for the ssh service.
started_or_enabled service=ssh
true

Stop Command

The start command restarts a specified service.

Possible returns:

PropertyDescription
falseThe service stopped or is not running.

The stop command requires you to include the service option in the command string. After entering the command correctly, it returns either a true or false output.

From the CLI prompt, enter:

service stop service=name

From the service prompt, enter:

stop service=name

Where:

  • name is the service name. For example, enter ssh for the ssh service.
stop service=ssh
false

Terminate_Process Command

The terminate_process command forces a service to stop and disables it.

The command only returns with true to show that the service stopped or is not running.

The terminate_process command requires you to include the pid option in the command string. You may also include the timeout option (not required) to specify the amount of time (in seconds) the system should attempt to terminate the service. After entering the command correctly, it returns either a true or false output.

From the CLI prompt, enter:

service terminate_process pid=number timeout=number

From the service prompt, enter:

terminate_process pid=number timeout=number

Where:

  • number is the pid (process id) and the number of seconds before the task times out. For example, 108648 and 1 to try terminating process 108648 for 10 seconds.
terminate_process pid=108648 timeout=true
true

Update Command

The update command lets you decide whether or not you want a service to start automatically upon system reboot.

The update command requires you to include the id_or_name and enable options in the command string.

From the CLI prompt, enter:

service update id_or_name=number/name enable=true/false

From the service prompt, enter:

update id_or_name=number/name enable=true/false

Where:

  • number/name is the service id name. For example, enter 11 or ssh for the ssh service.
  • true/false enables (true) or disables (false) the start automatically feature.
update id_or_name=ssh enable=true