hosting4devs CLI

The command-line interface.

  command [options] [arguments]

  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  help                                                    Displays help for a command
  list                                                    Lists commands

  hosting:addAndInstallSSLCertificate                     Add and install an SSL certificate.
  hosting:addHostingToBlackList                           Add a domain to black list.
  hosting:addHostingToWhiteList                           Add a domain to white list.
  hosting:addSSHPublicKey                                 Add a SSH public key for a user.
  hosting:changeHostingProcessManager                     Change hosting process manager.
  hosting:changeMySQLUserPassword                         Change MySQL user password.
  hosting:createGitDeployConfig                           Configure git deploy.
  hosting:createHosting                                   Create new hosting.
  hosting:createMailbox                                   Create new mailbox.
  hosting:createMailboxAlias                              New mailbox alias.
  hosting:createMySQLDatabaseAndAssignItToAnExistingUser  Create new MySQL database and assign it to an existing user.
  hosting:createMySQLDatabaseAndUser                      Create new MySQL database and user.
  hosting:createMySQLUser                                 Create new MySQL user.
  hosting:deleteGitDeployConfig                           Delete git deploy configuration.
  hosting:deleteHosting                                   Delete a hosting.
  hosting:deleteHostingFromBlackList                      Delete a domain from black list.
  hosting:deleteHostingFromWhiteList                      Delete a domain from white list.
  hosting:deleteMailbox                                   Delete a mailbox.
  hosting:deleteMailboxAlias                              Delete a mailbox alias.
  hosting:deleteMySQLDatabase                             Delete a MySQL database.
  hosting:deleteMySQLUser                                 Delete a MySQL user.
  hosting:deleteSSHPublicKey                              Delete a SSH public key.
  hosting:deleteSSLCertificate                            Delete an SSL certificate.
  hosting:generateSSHKey                                  Generate a new SSH key and add it to the ssh-agent.
  hosting:getAvailableAddons                              Get available addons.
  hosting:getGitDeployInfo                                Get info about git deploy configuration and last execution.
  hosting:getHostingAntispamList                          Get hosting antispam list.
  hosting:getHostingDetailedInformation                   Get detailed information about a hosting.
  hosting:getHostingDiskUsageSummary                      Get hosting disk usage summary.
  hosting:getHostingFTPStatus                             Get hosting FTP status.
  hosting:getHostingMailServiceDetailedInformation        Get hosting mail service detailed information.
  hosting:getHostingMailServiceStatus                     Get hosting mail service status.
  hosting:getHostingMailboxes                             Get hosting mailboxes.
  hosting:getHostingMySQLDetailedInfo                     Get hosting MySQL detailed info.
  hosting:getHostingQuota                                 Get hosting quota.
  hosting:getHostingSSHAuthMode                           Get hosting SSH auth mode.
  hosting:getHostingSSHStatus                             Get hosting SSH status.
  hosting:getHostingSSLCertificateInformation             Get hosting SSL certificate information.
  hosting:getHostingSSLStatus                             Get hosting SSL status.
  hosting:getHostingSpamassassinPreferences               Get hosting spamassassin preferences.
  hosting:getHostingStatus                                Get hosting status.
  hosting:getHostingTotalDiskUsage                        Get hosting total disk usage.
  hosting:getInstalledAddons                              Get installed addons.
  hosting:getMailboxAliasInfo                             Get mailbox alias info.
  hosting:getMailboxInfo                                  Get mailbox info.
  hosting:getMailboxesAliases                             Get mailboxes aliases.
  hosting:getSSHPublicKey                                 Get SSH public key content.
  hosting:getLetsEncryptCertificateStatus                 Get the Let's encrypt certificate status.
  hosting:renewLetsEncryptCertificate                     Renew the Let's encrypt certificate.
  hosting:requestAndInstallLetsEncryptCertificate         Request and install Let's encrypt certificate.
  hosting:setHostingFTPStatus                             Set hosting FTP status.
  hosting:setHostingMailServiceStatus                     Set hosting mail service status.
  hosting:setHostingPassword                              Change hosting password.
  hosting:setHostingQuota                                 Set hosting quota.
  hosting:setHostingSSHStatus                             Set hosting SSH status.
  hosting:setHostingSSLStatus                             Set hosting SSL status.
  hosting:setHostingSpamassassinPreferences               Set hosting spamassassin preferences.
  hosting:setHostingStatus                                Set hosting status.
  hosting:setMailboxAliasStatus                           Set mailbox alias status.
  hosting:setMailboxPassword                              Change mailbox password.
  hosting:setMailboxQuota                                 Set mailbox quota.
  hosting:setMailboxStatus                                Set mailbox status.
  hosting:setSSHAuthMode                                  Set SSH auth mode.
  hosting:setWebDocumentRoot                              Set web document root path.
  hosting:uninstallAddon                                  Uninstall addon.
  hosting:updateGitDeployConfig                           Update git deploy configuration.

  recipes:getAvailableRecipes                             Get available recipes.
  recipes:getRecipeInstallationStatus                     Get recipe installation status.
  recipes:getServerRecipes                                Get server recipes.

  server:addFirewallRule                                  Add new firewall rule.
  server:firewallDisallowIP                               Block IP.
  server:firewallRemoveDisallowedIP                       Unblock IP.
  server:getActiveServersFullList                         Get full list of active servers.
  server:getActiveServersList                             Get list of active servers.
  server:getDetailedHostingsInfo                          Get detailed hostings info.
  server:getDetailedIPsInfo                               Get detailed IPs info.
  server:getDetailedServerInfo                            Get detailed server info.
  server:getDetailedServerSettings                        Get detailed server settings.
  server:getFirewallRules                                 Get firewall rules.
  server:getGitDeployInfoByToken                          Get deploy information by token.
  server:getGitDeploymentsInfo                            Get git deployments info.
  server:getHostings                                      Get hostings.
  server:getInstalledPackages                             Get installed packages.
  server:getMySQLVersion                                  Get MySQL version.
  server:getServerDiskUsage                               Get server disk usage.
  server:getServerLoadAverage                             Get server load average.
  server:getServerMemoryUsage                             Get server memory usage.
  server:getServerServicesDetailedInfo                    Get server services detailed info.
  server:getServerSpamassassinPreferences                 Get server spamassassin preferences.
  server:getServerTimeInformation                         Get server time information.
  server:getServerUptime                                  Get server uptime.
  server:getServiceInformation                            Get service information.
  server:manageServerService                              Manage server service.
  server:manageServerServiceStatus                        Manage server service status.
  server:removeFirewallRule                               Remove firewall rule.
  server:setRootPassword                                  Set MySQL root password.
  server:setServerSpamassassinPreferences                 Set server spamassassin preferences.
  server:setServerTimezone                                Set server timezone.

  snippets:deleteSnippetByToken                           Delete snippet by token.
  snippets:getSnippetByToken                              Get snippet by token.
  snippets:getSnippetExecutionInfo                        Get snippet execution by execution token.
  snippets:getSnippetExecutionsByToken                    Get snippet executions.
  snippets:getUserSnippets                                Get user snippets.
  snippets:getUserSnippetsExecutionQueue                  Get user snippets execution queue.
  snippets:markSnippetExecutionAsViewed                   Mark a snippet execution as viewed.
  snippets:publishSnippet                                 Add new snippet.
  snippets:updateSnippet                                  Update the snippet indetified by token.

  task:executeSnippet                                     Execute a snippet with the given token.
  task:installAddon                                       Install hosting addon.
  task:installRecipes                                     Install recipes.
  task:rebootServer                                       Reboot server.
  task:runGitDeployment                                   Run the deploy identified by the given deploy token.
  task:uninstallH4DCS                                     Uninstall H4DCS and remove the server from hosting4devs platform.


  • bash (with sed, grep, mktemp)
  • curl


Download the binary

cd ~
wget -O h4d-cli
chmod +x h4d-cli

Optionally, you may create a symbolic link in /usr/local/bin:

ln -s ~/h4d-cli /usr/local/bin


You must define H4D_CONFIG_FILE_PATH environment var with the route to your INI config file.


export H4D_CONFIG_FILE_PATH=/path/to/your/config/file.ini

The INI file must content your API user name and API password. See next example:

------- INI file contents -------
user = "your-api-user-nane"
pass = "your-api-password"

In addition to this you can set the output format. See an example below:

; Valid values for outputFormat: text, json, json-pretty-print
outputFormat = "json"

Run a command

h4d-cli server:getActiveServersList

Executing command server:getActiveServersList...
-------------------- DATA --------------------
  0: server-001
  1: server-002