Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation

Reboot a Server — reboot

This function can restart a server gracefully or forcefully. Whether it is a graceful reboot or a forceful reboot is determined by a single boolean variable, forceful.

Calling Functions

Using the XML API

To use the XML API to perform the reboot function from within your custom script:

  • Append the /xml-api/reboot function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/xml-api/reboot

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Using the JSON API

To use the JSON API to perform the reboot function from within your custom script:

  • Append the /json-api/reboot function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/json-api/reboot

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Variables

Input

The reboot function takes the following optional variable as input:
  • force (boolean) — Initiates a forceful reboot.
    • 1 — Initiates the forceful reboot.
    • 0 — Initiates a graceful reboot.
      PICK Remember: A forceful reboot may result in data loss if processes are still running when the server restarts.

Output

  • reboot — Root-level XML tag for the output of the reboot function.
    • reboot (string) — The status of the reboot operation.

Examples

XML API

Calling https://example.com:2087/xml-api/reboot in WebHost Manager will produce something similar to:

<reboot>
    <reboot>normal</reboot>
</reboot>

JSON API

Calling https://example.com:2087/json-api/reboot in WebHost Manager will produce output similar to:

{
   "reboot":"normal"
}

Calling https://example.com:2087/json-api/reboot?forceful=1 in WebHost Manager will produce output similar to:

{
   "reboot":"normal"
}

Topic revision: r2 - 29 Sep 2009 - 18:33:40 - MelanieSeibert