service: Services

The service utility is used to manage services on the Plesk server through CLI. By using this utility, you can perform the following tasks:

  • displaying a list of available services
  • starting, stopping, or restarting a service
  • querying the current running status of a service
  • specifying the information to be included in the list of available services and format its display parameters

Usage
service <command> [
<option_1> [<param>]
[<option_2> [<param>]]
... [<option_N> [<param>]]
]

Example

The following command displays detailed information about the dns, mail, and tomcat services as a table:

plesk bin service --list -include dns,mail,tomcat -format "\n\t%k,\t%N,\t%S\t%I\t%p\n"

Commands
Command Parameter Description Example

--start or -s

<service_
name>

Starts a service.

To start the DNS service:

plesk bin service --start dns

or

plesk bin service -s dns

--stop or -p

<service_
name>

Stops a service.

To stop the DNS service:

plesk bin service --stop dns

or

plesk bin service -p dns

--restart or -r

<service_
name>

Restarts a service.

To restart the DNS service:

plesk bin service --restart dns

or

plesk bin service -r dns

--status or -t

<service_
name>

Displays the current status of a service.

To view the current status of the DNS service:

plesk bin service --status dns

or

plesk bin service -t dns

--list or -l

 

Displays information about available services.

Can be used with the -detail and -format options to display detailed information about services.

To view the list of available services:

plesk bin service --list

or

plesk bin service -l

--help or -h

 

Displays help on the use of the utility.

To view help on the use of the utility:

plesk bin service --help

or

plesk bin service -h

Options
Option Parameter Description Example

-include

<service_name_1>[,<service_keyname_2>,... <service_name_N>]

Specifies the list of services to be included in the --list command output.

To view detailed information about DNS, Mail, and Tomcat services only:

plesk bin service -l -include dns,mail,tomcat -detail

-exclude

<service_name_1>[,<service_keyname_2>,... <service_name_N>]

Specifies the list of services to be excluded from the --list command output.

To view detailed information about all services excluding DNS, Mail, and Tomcat services:

plesk bin service -l -exclude dns,mail,tomcat -detail

-detail

 

Set the detailed format for the --list command output (equivalent to -format "%k\t%N\t%S\t%I\t%p\n").

-format

"%<output_parameter_1>[,%<output_parameter_2>,...,%<output_parameter_N>"

use \n, \t, or a comma to format the output display as needed.

Specifies the information to be included in the detailed output and the display parameters of the --list command.

  • %k - service key
  • %N - service name
  • %s - service status code
  • %S - service status
  • %i - available code
  • %I - information about available code
  • %p - package name
  • %% - %
  • \n - new line
  • \t - tab

Is set to"%k" by default.

To view detailed information about DNS, Mail, and Tomcat services as a table:

plesk bin service -l -include dns,mail,tomcat -format "\n\t%k,\t%N,\t%S\t%I\t%p\n"