# Console/CLI commands

# How to get an access to CLI commands

Login to your server via ssh and run the following command to access installed tracker:

cd /var/www/keitaro

# Additional info about the command

sudo -u keitaro php bin/cli.php command_name --help

# Full list of the commands

Run the comman to get an up-to-date list of available commands:

sudo -u keitaro php bin/cli.php list

Output example:

Available commands:
  help                         Displays help for a command
  list                         Lists commands
  macros                       Show available macros
 admin
  admin:create                 Create admin user
  admin:change_password        Change admin user password
...  

# help

sudo -u keitaro php bin/cli.php help

Displays help.

# list

sudo -u keitaro php bin/cli.php list

Shows the list of available commands.

# macros

sudo -u keitaro php bin/cli.php macros

Shows the list of available macros.

Output examples:

For URLs
+--------------------------+---------------------------+-------------+
| Macro                    | Aliases                   | Description |
+--------------------------+---------------------------+-------------+
| {ad_campaign_id}         |                           |             |
| {browser_version}        |                           |             |
...

+--------------------------+---------------------------+-------------+
For postbacks
+---------------------------+---------+-------------+
| Macro                     | Aliases | Description |
+---------------------------+---------+-------------+
| {conversion_cost:code}    |         |             |
| {conversion_profit:code}  |         |             |
...

# admin:create

sudo -u keitaro php bin/cli.php admin:create <login> <password>

Creates a new admin.

# admin:change_password

sudo -u keitaro php bin/cli.php admin:change_password <password>

Change password for user admin. You can specify login by adding --login=<username>.

# admin_api:routes

sudo -u keitaro php bin/cli.php admin_api:routes

Show Admin API routes.

Output example:

+--------+-----------------------------------------------+------------------------------------------------------------------+
| Method | Route                                         | Description                                                      |
+--------+-----------------------------------------------+------------------------------------------------------------------+
| POST   | /admin_api/v1/conversions/log                 | Retrieve the conversions                                         |
| GET    | /admin_api/v1/campaigns/{campaign_id}/streams | Retrieve streams of a campaign                                   |
| POST   | /admin_api/v1/streams                         | Create a stream                                                  |
...

# bots:import

sudo -u keitaro php bin/cli.php bots:import

Imports the bots list.

# cron:run

sudo -u keitaro php bin/cli.php cron:run

Runs cron task.

# db:migrate

sudo -u keitaro php bin/cli.php db:migrate

Runs all migrations.

# geodbs:list_updates

sudo -u keitaro php bin/cli.php geodbs:list_updates

Lists geo-bases updates.

# geodbs:update

sudo -u keitaro php bin/cli.php geodbs:update <db-id>

Updates a definite geo-base.

# geodbs:update_all

sudo -u keitaro php bin/cli.php geodbs:update_all

Updates all geo-bases.

# migrations:create

sudo -u keitaro php bin/cli.php migrations:create

Creates a new migration.

# migrations:list

sudo -u keitaro php bin/cli.php migrations:list

Lists all migrations and their statuses.

Runs legacy migration.

# seed:clicks

sudo -u keitaro php bin/cli.php seed:clicks

Seeds clicks.

# seed:conversions

sudo -u keitaro php bin/cli.php seed:conversions

Seeds conversions.

# system:check_update

sudo -u keitaro php bin/cli.php system:check_update

Shows the current version and lists available updates.

# system:delete_all_stats

sudo -u keitaro php bin/cli.php system:delete_all_stats

Deletes the stats and adds the free space on a disk.

After the command is run you'll get a warning:

[WARNING] Important! The following will happen:                                                                 
           - old versions tables removal,                                                                        
           - clicks stats to the exact date removal (if specified in parameters),                                
           - optimization of the clicks in the stats,                                                            
           - cleaning all the current stats completely (if specified in parameters).                             
 
           These inquiries will block the database                                                               
           during the implementation and require additional free space on a disk. 

Next, confirm the command (yes/no).

The stats will be deleted.

# system:generate_config

sudo -u keitaro php bin/cli.php system:generate_config

Generates a new config.ini.php file.

# system:optimize_table

sudo -u keitaro php bin/cli.php system:optimize_db

Optimizes database tables.

# system:reload_cache

sudo -u keitaro php bin/cli.php system:reload_cache

Reloads cache.

# system:restart_roadrunner

sudo -u keitaro php bin/cli.php system:restart_roadrunner 

Reloads road runner.

# system:self_update

sudo -u keitaro php bin/cli.php system:self_update 

Updates Keitaro.

Last Updated: 5/25/2020, 5:25:43 AM