Doing tasks from the "panel" on the command line


#1

Hi there,
I am trying to setup an automated swap between servers if there is a problem with some data I’m analyzing. To do that I want to switch the “Hosting status” of a domain.

Specifically I want my domain to “mirror” another domain that is fully hosted here at Dreamhost.

I want this to happen from a shell/perl script that will be executed on the command line from cron.

Anyone know if there is a way of executing tasks normally done manually on the web panel, but from the shell/command line?

Thanks


#2

There is no published API for the DreamHost control panel, so any such “panel automation” you wish to accomplish requires developing methods to accomplish such things that rely on the current operation of the Contol Panel and that may break in DreamHost should change the way their Contol Panel works.

Previous poster to these forums have posted working code (in PHP) to do certain things (create an email alias for forwarding, and add a subdomain to the DreamHost system) as a “proof of concept” - and you can run PHP from the command line so I suspect you could use that as a “base” for developing custom “panel tools”.

Essentially the process involves using cURL to initiate a session, create a “logged in” state in the panel, and pass appropriately constructed urls to the panel to manipulate it.

–rlparker