Restart service

This function restarts a service, or daemon, on a server.

Note:

If the user only possesses the clustering Access Control List (ACL) then this function can only act on the named service.

SecurityBasicAuth
Request
query Parameters
service
required
string

The service to restart. For a list of possible values, read our Access Control List (ACL) documentation.

Example: service=exim
queue_task
integer
Default: 0

Whether to queue this task.

  • 1 — Queue.
  • 0 — Do not queue.

Note:

This parameter affects the output return.

Enum: 0 1
Example: queue_task=0
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
object
get/restartservice
Request samples
whmapi1 --output=jsonpretty \
  restartservice \
  service='exim'
Response samples
application/json
{
  • "data": {
    • "output": "Waiting for httpd to restart..............finished.\\n\\nhttpd (/usr/local/apache/bin/httpd -k start -DSSL) running as root with PID 21379\\nhttpd (/usr/local/apache/bin/httpd -k start -DSSL) running as root with PID 21385\\n\\nhttpd started ok\\n",
    • "service": "exim"
    },
  • "metadata": {
    • "command": "restartservice",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}