The InterWorx Control Panel offers a command-line utility allowing server administrators to perform InterWorx functions without having to log in to the web interface. This utility can also be used in shell scripts to perform automated batch operations.
The CLI utility is comprised of two commands: ’nodeworx’ and ’siteworx’. The ’nodeworx’ command is used to perform administrator and reseller functions that you would normally access in the NodeWorx control panel; the ’siteworx’ command is used to perform SiteWorx user functions on specific SiteWorx accounts that are normally accessed on the SiteWorx control panel.
For example, adding a new reseller would be done by using the ’nodeworx’ command and adding a new e-mail alias for a SiteWorx user would be done by using the ’siteworx’ command.
Both commands allow you to use the -h option to get a usage summary.
In order to use these commands, you must supply authentication. The basic way to authenticate is to simply use either the nodeworx or siteworx command and you will be prompted for credentials.
Notice that the SiteWorx login also requires that you enter the domain of the SiteWorx account in question, just like logging in via the web interface.
Below you will find the list of available Controllers. Each controller is essentially a section of InterWorx. As you can see, they are exactly the same as the menu items in the NodeWorx web interface. Similarly for the siteworx command, the controllers listed are the same as the menu items in the SiteWorx web interface. You can select which controller you want to access by entering its menu number in the prompt.
Let’s say you just want to see what you can do with the "SiteWorx: Accounts Controller" so you enter ’8’. Every controller has Actions associated with it, as you can see below.
These are what allow you to select the specific operation to perform. Say you wanted to add a new SiteWorx account - you enter ’9’ for the add action. You are then prompted for the necessary information to perform this action.
While the interactive mode of the CLI utility may be useful, ultimately you probably want to use the CLI utility in scripts, which you can’t do in interactive mode. In order to do this, you first need to figure out what the proper arguments are, and this is where the -h usage option becomes a great resource because it documents all the controllers, actions, and arguments you need to use to perform InterWorx tasks.
Notice that now after the list of controller options, the list of actions you can do with the FTP controller is listed. If you specify the ’add’ action, the -h option again will change to show you what arguments you need to add an FTP account.
Now the controller and action documentation has been replaced with the arguments you pass to the action (--user, --password, --confirm_password, --homedir) at the bottom. To construct the final command which will add the FTP account, we need to remove the -h option because we don’t need documentation anymore and we add the -n non-interactive option to make the CLI utility not prompt us for anything.
This will silently, non-interactively, add a SiteWorx FTP account. Notice that for --password arguments, you need the --confirm_password argument too. If you want to see the result of your non-interactive command, you can optionally add a -v which enables verbose mode. You can follow this procedure to figure out the proper controller/action/arguments combination to perform any InterWorx task you desire.
Use the -h option for documentation.
Use the -n option for non-interactive mode.
Use the -v option for verbose mode. Good for non-interactive mode if you want see a success message printed to the screen.