Integration is set up when a new processing module is added in BILLmanager. This module can be added in Integration → Processing modules → button Add. It consists of the following steps:
- Step 1 — Product type. Select a product type. This integration is available for any product type that has been created manually and for shared hosting.
- Step 2 — Processing module. Select a processing module. You need to select ShellScripts.
- Step 3 — Integration settings. Enter information for integration with ShellScripts.
- Step 4 — Processing module parameters. Set up the internal parameters of the module.
Integration settings
IP address — address of the server where the service is processed.
Has root password — authorization method for the server with root rights:
- Unchecked — use public SSH key located on the server in the directory '/root/.ssh/authorized_keys'.
- Checked — root password. To be specified in the Password field.
Path to scripts — server directory to store the scripts.
Script requirements
You must have the following scripts to have this module working:
- open.sh describes service opening.
- resume.sh describes service resuming after suspension.
- suspend.sh describes service suspension.
- close.sh describes service closing.
- setparam.sh describes editing order parameters by the client. This script is optional.
Service activation script
The script open.sh is to use the following parameters:
- Additional tariff resources in the format --addon=value. addon is an internal resource name, 'value' is resource value to be ordered.
- Tariff plan parameters in format --param=value. param is an internal parameter name, 'value' is parameter value to be ordered.
- Name and password for the account generated by the billing system. Format: --user=<username> and --password=<password>.
If service is activated successfully, the script must end up with the return code 0 and must return the line which:
- starts with "OK".
- has all output parameters separated with spaces. Format for parameter output: --param1=value --param2=value.
- contains a unique service id. The service will be processed later with this parameter.
All script output parameters are stored in BILLmanager database in the table itemparam. 'id' is saved under the name externalid. Also, this table will have the name and password of the account.
#!/bin/bash
for i
do
if [ ${i:0:6} = "--user" ]
then
username=${i:7}
elif [ ${i:0:10} = "--password" ]
then
password=${i:11}
fi
done
useradd $username -d /home/ftp_folder -m -s /bin/false
echo $password | passwd --stdin $username > /dev/null
echo "OK --id=$username --username=$username --password=$password"
Service interaction scripts
The scripts resume.sh, suspend.sh, and close.sh are to use the following parameters:
- Unique service ID in format --id=<externalid>.
- Account name generated at service opening in the format: --user=<username>.
If an action is successful, the script must end up with the return code 0 and must return the line which starts with OK (Latin alphabet symbols).
#!/bin/bash
for i
do
string=${i}
if [ ${string:0:4} = "--id" ]
then
username=${string:5}
fi
done
usermod -d /home/ftp_folder $username
echo "OK"
#!/bin/bash
for i
do
string=${i}
if [ ${string:0:4} = "--id" ]
then
username=${string:5}
fi
done
usermod -d /dev/null $username
echo "OK"
#!/bin/bash
for i
do
string=${i}
if [ ${string:0:4} = "--id" ]
then
username=${string:5}
fi
done
userdel $username
echo "OK"
Service edition scripts
The script setparam.sh is to use the following parameters:
- Additional tariff plan resources in format --addon=value. addon is the internal resource name, 'value' is the value of the resource to be ordered.
- Tariff plan parameters in format --param=value. param is the internal parameter name, 'value' is parameter value to be ordered.
- Service ID and account name generated at service opening. Formats: --id=<externalid> and --user=<username>.
If parameters are changed successfully, the script must end up with the return code 0 and must return the line which starts with OK (Latin alphabet symbols).