Configuring Custom Commands
Custom Commands module provides a simple interface to run custom commands and edit certain files on your server at the press of a button. However, before this can be used, CP+ admin should create these buttons and make them available to users.
- Log in as admin at http://cpplus_host_domain:10000/
- Choose the System Administration CP+ mode.
- Scroll down to the Others section and click the Custom Commands icon. You will have the following options to choose from:

- Create a new custom command
- Edit command
- Create a new file editor
- Create a new SQL command
-
In the Create Command / Edit Command form, fill out/modify the following fields:

- Description: enter the text of the custom command button in the upper input line and description to the button in the textarea.
- Command: the actual command to execute. Because commands are run in shell syntax, they may contain any shell metacharacters like |, >, && and ; for executing multiple commands and pipelines. Here you may add command parameters entered by user running this command from his/her CP+ interface.
- Run in directory: by default, the specified command will run in the directory containing this module's programs, which will be something like /usr/local/cpplus/custom. This option can be used to specify different directory, which can be useful for avoiding the need to use full paths for the command and its parameters.
- Run as user: Unix user to run the command. If CP+ user is chosen, this command can be run by any of CP+ users.
- Command outputs HTML? set this option to "Yes" if your command's output is in HTML format.
- Ordering on main page: set the command's ordering number to define the command's place in the list of Custom Commands.
- Hide command when executing? if this option is enabled, the command line being executed (which parameter substitutions) will not be shown when the custom command is run.
- Available in End User CP+? if selected, this command or file editor will appear in End User CP+'s Custom Commands module as well for any user to run. Be careful which commands you select this option for.
- Maximum time to wait for command? set the command's timeout with this option. If it is set to Forever, the module will wait indefinately for the command to complete.
- Command Parameters: parameters replaced by user inputs when the command is run.
- Name: parameter name, like dir in the ls -la $dir command.
- Description: the description next to this parameter on the main page.
- Type: the parameter's input type:
- Text a totally free-text input.
- User a username from your system.
- UID the UID of a user from your system.
- Group a group name from your system.
- GID the GID of a group from your system.
- File the full path to a file.
- Directory the full path to a directory.
- Option a Yes/No input that will set the parameter to whatever is in the field next to the type input only if Yes is chosen.
- Password a totally free-text input, but with the input replaced by *'s.
- Menu a drop-down menu of options, taken from the filename entered into the text field to it.
- Quote parameter? if Yes, the parameter will be quoted with " before substitution, allowing the user to enter values containing whitespaces.
Make sure to click Save to preserve changes. 
-
You may also create buttons to edit certain files. To create a button to edit a file, click the Create file editor link. To edit an existing file edition, click Edit file editor link. In the Create File Editor/Edit File Editor form, fill out/modify the following fields:

- Description: enter the text of the custom file editor's button in the upper input line and description to the button in the textarea.
- File to edit: the file's pathname. If the file doesn't exist, the system would try to create it.
- File permissions: set the file permissions as by the chmod command (like 644) or leave the file permissions as it is.
- Command to run before saving: whatever command is entered here will be run as root before the file is saved. This could be useful for making a backup of the file for example.
- Command to run after saving: whatever command is entered here will be run as root before the file is saved. This could be useful for making a backup of the file for example.
- Ordering on main page: set the ordering number of the file editor to define its place in the list of Custom Commands.
- Available in End User CP+? if selected, this command or file editor will appear in End User CP+'s Custom Commands module as well for any user to run. Be careful which commands you select this option for.
Make sure to click Save to preserve changes. 
-
To create a new SQL command, click the Create a new SQL command link. In the form fill out the following fields:

- Description: enter the text of the custom command button in the upper input line and description to the button in the textarea.
- SQL command to execute: the actual command to execute.

|