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/
- Click on the Others tab and then choose Custom Commands:

- To create a new custom command, click on the
Create a new custom command link. To edit an existing command,
click on Edit command:

- In the Create Command / Edit Command form, fill out or modify the following fields
and then press Save:
- 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 (like ls $options $dir in the above screenshot).
- 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 a
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 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 Usermin? enable this option to make the command available
in CP+ user interface.
- 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.
- You may also create buttons for editing 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:

- In the Create File Editor/Edit File Editor form, fill out or 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 owners: set the file owner's user and group
or leave the file ownership as it is.
- 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 Usermin? enable this option to make the file editor available
in CP+ user interface.
|