- Created by Documentation, last modified on Apr 09, 2018
Description
This function restarts a service, or daemon, on a server.
Examples
https://hostname.example.com:2087/cpsess##########/json-api/restartservice?service=httpd
https://hostname.example.com:2087/cpsess##########/xml-api/restartservice?service=httpd
whmapi0 restartservice service=httpd
Notes:
- You must URI-encode values.
- For more information and additional output options, read our Guide to WHM API 0 documentation or run the
whmapi0 --help
command. If you run CloudLinux™, you must use the full path of the
whmapi0
command:/usr/local/cpanel/bin/whmapi0
{ "restart":[ { "result":1, "service":"httpd", "rawout":"Waiting for httpd to restart..............finished.\n\nhttpd (/usr/local/apache/bin/httpd -k start -DSSL) running as root with PID 21379\n httpd (/usr/local/apache/bin/httpd -k start -DSSL) running as root with PID 21385 \n\nhttpd started ok\n", "servicename":"Apache Web Server" } ] }
<restartservice> <restart> <rawout>Waiting for httpd to restart..............finished. httpd (/usr/local/apache/bin/httpd -k start -DSSL) running as root with PID 19446 httpd (/usr/local/apache/bin/httpd -k start -DSSL) running as root with PID 19452 httpd started ok </rawout> <result>1</result> <service>httpd</service> <servicename>Apache Web Server</servicename> </restart> </restartservice>
Parameters
Parameter | Type | Description | Possible values | Example |
---|---|---|---|---|
service | string | Required The service to restart. | For a list of possible values, read our Service Manager documentation. | mysql |
Returns
Return | Type | Description | Possible values | Example |
---|---|---|---|---|
restart | array of hashes | An array of hashes that contain service data. | This array of hashes includes the rawout , result , service , and servicename returns. | |
| string | The The function returns this value in the | A string of raw HTTP data. | Click to view
(/usr/local/apache/bin/httpd -k start -DSSL) running as root with PID 21379\n httpd (/usr/local/apache/bin/httpd -k start -DSSL) running as root with PID 21385 \n\nhttpd started ok\n
|
| Boolean | The result of the function. The function returns this value in the |
| 1 |
| string | The restarted service. The function returns this value in the | For a list of possible values, read our Service Manager documentation. | httpd |
| string | The restarted service's full name. The function returns this value in the | A string value. | Apache Web Server |
Function information
API Version:
WHM API 1 Equivalent:
Important:
We strongly recommend that you use WHM API 1. WHM API 0 is deprecated.
Available in:
WHM 11.32+
Methods:
GET, POST
Required Parameters:
service
Return Formats:
About WHM API 0
Warning:
WHM API 0 is deprecated. We strongly recommend that you use the equivalent WHM API 1 function instead.
Notes:
- Some functions and parameters may require that you authenticate as the
root
user. - You must use the appropriate WHM ports (
2086
or2087
) to call WHM API functions.
Find a function
Related functions
-
Page:WHM API 0 Sections - Server Administration — Server Administration functions manage your cPanel & WHM server.
-
Page:WHM API 0 Functions - restartservice — This function restarts a service, or daemon, on a server.
-
Page:WHM API 0 Functions - servicestatus — This function reports which services are enabled, installed, and monitored on a server.
-
Page:WHM API 0 Functions - configureservice — This function enables or disables a service and whether the system monitors it.
-
Page:WHM API 0 Functions - configureservice — This function enables or disables a service and whether the system monitors it.