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

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:

php bin/cli.php list
Available commands:
  help                         Displays help for a command
  list                         Lists commands
  macros                       Show available macros
 admin
  admin:create                 Create admin user
 admin_api
  admin_api:routes             Show API routes
 bots
  bots:import                  Import bot list (don't run the command as root!)
 cron
  cron:run                     Run cron task (don't run the command as root!)
 db
  db:dump_schema               dump db schema
  db:migrate                   Run all migrations (don't run the command as root!)
  db:seed                      Seed db with some data
  db:setup                     Create new DB and import schema.sql and tables.sql
 geodbs
  geodbs:list_updates          List geodb updates
  geodbs:update                Update specific geodb
  geodbs:update_all            Update all Geo DBs
 migrations
  migrations:create            Create new migration
  migrations:list              List all migrations
  migrations:run-legacy        Run legacy migration
 seed
  seed:clicks                  Seed clicks
  seed:conversions             Seed conversions data
 system
  system:check_update          List of available updates
  system:generate_config       Generate new config.ini.php
  system:optimize_table        Optimize database tables
  system:reload_cache          Reload cache (don't run the command as root!)
  system:restart_roadrunner    Restart roadrunner server
  system:self_update           Update Keitaro (don't run the command as root!)

help

php bin/cli.php help

Displays help.

Usage:
  help [options] [--] [<command_name>]
 
Arguments:
  command               The command to execute
  command_name          The command name [default: "help"]
 
Options:
      --format=FORMAT   The output format (txt, xml, json, or md) [default: "txt"]
      --raw             To output raw command help
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 
Help:
  The help command displays help for a given command:
 
    php bin/cli.php help list
 
  You can also output the help in other formats by using the --format option:
 
    php bin/cli.php help --format=xml list
 
  To display the list of available commands, please use the list command.

list

php bin/cli.php list

Shows the list of available commands.

macros

php bin/cli.php macros

Shows the list of available macros.

For URLs
+--------------------------+---------------------------+-------------+
| Macro                    | Aliases                   | Description |
+--------------------------+---------------------------+-------------+
| {ad_campaign_id}         |                           |             |
| {browser_version}        |                           |             |
| {browser}                |                           |             |
| {city:lang}              |                           |             |
| {connection_type:lang}   |                           |             |
| {cost:code}              |                           |             |
| {creative_id}            |                           |             |
| {current_domain}         |                           |             |
| {date:format}            |                           |             |
| {debug}                  |                           |             |
| {destination}            |                           |             |
| {device_brand}           |                           |             |
| {device_model}           |                           |             |
| {device_type:lang}       |                           |             |
| {example:charset}        |                           |             |
| {external_id}            |                           |             |
| {from_file:file}         |                           |             |
| {ip}                     |                           |             |
| {is_bot}                 |                           |             |
| {is_using_proxy}         |                           |             |
| {isp}                    |                           |             |
| {keyword:charset}        |                           |             |
| {keyword_cp1251:charset} |                           |             |
| {language}               |                           |             |
| {offer:offerId}          |                           |             |
| {os_version}             |                           |             |
| {os}                     |                           |             |
| {parent_campaign_id}     |                           |             |
| {profit:code}            |                           |             |
| {random}                 |                           |             |
| {revenue:code}           |                           |             |
| {sample:var1,var2,varN}  |                           |             |
| {source}                 |                           |             |
| {stream_id}              |                           |             |
| {sub_id_10}              |                           |             |
| {sub_id_11}              |                           |             |
| {sub_id_12}              |                           |             |
| {sub_id_13}              |                           |             |
| {sub_id_14}              |                           |             |
| {sub_id_15}              |                           |             |
| {sub_id_1}               |                           |             |
| {sub_id_2}               |                           |             |
| {sub_id_3}               |                           |             |
| {sub_id_4}               |                           |             |
| {sub_id_5}               |                           |             |
| {sub_id_6}               |                           |             |
| {sub_id_7}               |                           |             |
| {sub_id_8}               |                           |             |
| {sub_id_9}               |                           |             |
| {token}                  |                           |             |
| {traffic_source_name}    |                           |             |
| {ts_id}                  |                           |             |
| {campaign_id}            | keitaro_campaign_id       |             |
| {campaign_name}          | keitaro_campaign_name     |             |
| {country:lang}           | country_code,country_name |             |
| {landing_id}             | keitaro_landing_id        |             |
| {offer_id}               | keitaro_offer_id          |             |
| {operator:lang}          | carrier                   |             |
| {referrer}               | referer                   |             |
| {region:lang}            | region_name               |             |
| {search_engine}          | se                        |             |
| {subid:xSeparator}       | sub_id                    |             |
| {user_agent}             | ua,useragent              |             |
+--------------------------+---------------------------+-------------+
For postbacks
+---------------------------+---------+-------------+
| Macro                     | Aliases | Description |
+---------------------------+---------+-------------+
| {conversion_cost:code}    |         |             |
| {conversion_profit:code}  |         |             |
| {conversion_revenue:code} |         |             |
| {conversion_time:format}  |         |             |
| {original_status}         |         |             |
| {status:mapping}          |         |             |
| {tid}                     |         |             |
| {visitor_id}              |         |             |
+---------------------------+---------+-------------+

admin

php bin/cli.php admin:create <login> <password>

Creates a new admin.

Admin API

php bin/cli.php admin_api:routes

Show Admin API routes.

+--------+-----------------------------------------------+------------------------------------------------------------------+
| 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                                                  |
| DELETE | /admin_api/v1/streams/{id}                    | Move steam to archive                                            |
| PUT    | /admin_api/v1/streams/{id}                    | Update a stream                                                  |
| GET    | /admin_api/v1/streams/deleted                 | Retrieve deleted streams                                         |
| GET    | /admin_api/v1/streams/{id}                    | Retrieve a specific stream                                       |
| POST   | /admin_api/v1/streams/{id}/restore            | Restore an archived stream                                       |
| POST   | /admin_api/v1/streams/{id}/enable             | Enable a stream                                                  |
| POST   | /admin_api/v1/streams/{id}/disable            | Disable a stream                                                 |
| GET    | /admin_api/v1/streams/search                  | Search streams                                                   |
| GET    | /admin_api/v1/stream/:id/events               | Retrieve stream events                                           |
| GET    | /admin_api/v1/stream_types                    | Retrieve available stream types                                  |
| GET    | /admin_api/v1/stream_actions                  | Retrieve available stream actions                                |
| GET    | /admin_api/v1/stream_schemas                  | Retrieve available stream schemas                                |
| GET    | /admin_api/v1/groups                          | Get list of groups                                               |
| POST   | /admin_api/v1/groups                          | Create group                                                     |
| PUT    | /admin_api/v1/groups/{id}                     | Update group                                                     |
| DELETE | /admin_api/v1/groups/{id}/delete              | Delete group                                                     |
| GET    | /admin_api/v1/landing_pages                   | Retrieve all landing pages                                       |
| GET    | /admin_api/v1/landing_pages/{id}              | Retrieve a specific langin page                                  |
| PUT    | /admin_api/v1/landing_pages/{id}/clone        | Clone a landing page                                             |
| POST   | /admin_api/v1/landing_pages                   | Create a landing page                                            |
| PUT    | /admin_api/v1/landing_pages/{id}              | Edit a landing page                                              |
| DELETE | /admin_api/v1/landing_pages/{id}              | Archive landing page                                             |
| GET    | /admin_api/v1/campaigns                       | Retrieve all campaigns                                           |
| GET    | /admin_api/v1/campaigns/{id}                  | Retrieve the specific campaign                                   |
| POST   | /admin_api/v1/campaigns                       | Create a campaign                                                |
| PUT    | /admin_api/v1/campaigns/{id}                  | Update a campaign                                                |
| DELETE | /admin_api/v1/campaigns/{id}                  | Move a campaign to archive                                       |
| GET    | /admin_api/v1/campaigns/deleted               | Retrieve all deleted campaigns                                   |
| POST   | /admin_api/v1/campaigns/{id}/restore          | Restore an archived campaign                                     |
| POST   | /admin_api/v1/campaigns/{id}/disable          | Disable a specific campaign                                      |
| POST   | /admin_api/v1/campaigns/{id}/enable           | Enable a specific campaign                                       |
| POST   | /admin_api/v1/campaigns/{id}/clone            | Clone a campaign                                                 |
| POST   | /admin_api/v1/campaigns/{id}/update_costs     | Update a campaign costs                                          |
| GET    | /admin_api/v1/logs/{log}                      | Get log entries                                                  |
| GET    | /admin_api/v1/logs/types                      | Get log types                                                    |
| DELETE | /admin_api/v1/logs/{log}                      | Clean a log file                                                 |
| POST   | /admin_api/v1/clicks/summary                  | Retrieve summary data                                            |
| POST   | /admin_api/v1/report/build                    | Build a report                                                   |
| GET    | /admin_api/v1/report/definition               | Retrieve report definition                                       |
| GET    | /admin_api/v1/report/labels                   | Retrieve labels                                                  |
| GET    | /admin_api/v1/report/labels                   | Retrieve labels                                                  |
| POST   | /admin_api/v1/report/labels                   | Update labels                                                    |
| GET    | /admin_api/v1/streams_actions                 | Retrieve stream actions                                          |
| GET    | /admin_api/v1/traffic_sources                 | Retrieve all sources                                             |
| GET    | /admin_api/v1/traffic_sources/{id}            | Retrieve a specific source                                       |
| POST   | /admin_api/v1/traffic_sources/{id}/clone      | Clone source                                                     |
| POST   | /admin_api/v1/traffic_sources                 | Create a source                                                  |
| PUT    | /admin_api/v1/traffic_sources/{id}            | Update a source                                                  |
| DELETE | /admin_api/v1/traffic_sources/{id}            | Move to archive a source                                         |
| GET    | /admin_api/v1/domains                         | Retrieve all domains                                             |
| GET    | /admin_api/v1/domains/{id}                    | Retrieve the specific domain                                     |
| POST   | /admin_api/v1/domains/{id}/check              | Update status of the specific domain                             |
| POST   | /admin_api/v1/domains                         | Create a domain                                                  |
| PUT    | /admin_api/v1/domains/{id}                    | Update a domain                                                  |
| DELETE | /admin_api/v1/domains/{id}                    | Move domain to archive                                           |
| GET    | /admin_api/v1/domains/deleted                 | Retrieve all deleted domains                                     |
| POST   | /admin_api/v1/domains/{id}/restore            | Restore an archived domain                                       |
| POST   | /admin_api/v1/domains/{id}/clone              | Clone a domain                                                   |
| GET    | /admin_api/v1/affiliate_networks              | Get list of affiliate networks                                   |
| GET    | /admin_api/v1/affiliate_networks/{id}         | Get affiliate network details                                    |
| POST   | /admin_api/v1/affiliate_networks/{id}/clone   | Clone affiliate network                                          |
| POST   | /admin_api/v1/affiliate_networks              | Create affiliate Network                                         |
| PUT    | /admin_api/v1/affiliate_networks/{id}         | Update affiliate network                                         |
| DELETE | /admin_api/v1/affiliate_networks/{id}         | Archive affiliate network                                        |
| GET    | /admin_api/v1/botlist                         | Retrieve the additional bot list                                 |
| PUT    | /admin_api/v1/botlist                         | Update the additional bot list                                   |
| POST   | /admin_api/v1/botlist/add                     | Add IPs to the additional bot list                               |
| POST   | /admin_api/v1/botlist/exclude                 | Exclude IPs from the additional bot list                         |
| DELETE | /admin_api/v1/botlist                         | Clear the bot list                                               |
| GET    | /admin_api/v1/offers                          | Get list of offers                                               |
| GET    | /admin_api/v1/offers/{id}                     | Get a specific offer                                             |
| POST   | /admin_api/v1/offers                          | Create an offer                                                  |
| PUT    | /admin_api/v1/offers/{id}                     | Update an offer                                                  |
| POST   | /admin_api/v1/offers/{id}/clone               | Clone offer                                                      |
| DELETE | /admin_api/v1/offers/{id}/archive             | Move an offer to archive                                         |
| POST   | /admin_api/v1/clicks/log                      | Retrieve the clicks                                              |
| POST   | /admin_api/v1/clicks/clean                    | Clean stats (params timezone, start_date, end_date, campaign_id) |
+--------+-----------------------------------------------+------------------------------------------------------------------+

bots

DO NOT RUN THE COMMAND AS ROOT!

php bin/cli.php bots:import

Imports the bots list.

cron

DO NOT RUN THE COMMAND AS ROOT!

php bin/cli.php cron:run

Runs cron task.

db:dump_schema

php bin/cli.php db:dump_schema

Dumps database scheme.

db:migrate

DO NOT RUN THE COMMAND AS ROOT!

php bin/cli.php db:migrate

Runs all migrations.

db:seed

php bin/cli.php db:seed

Seed data to a database.

db:setup

php bin/cli.php db:setup

Creates a new DB and imports schema.sql and tables.sql.

geodbs:list_updates

php bin/cli.php geodbs:list_updates

Lists geo-bases updates.

geodbs:update

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

Updates a definite geo-base.

geodbs:update_all

php bin/cli.php geodbs:update_all

Updates all geo-bases.

migrations:create

php bin/cli.php migrations:create

Creates a new migration.

migrations:list

php bin/cli.php migrations:list

Lists all migrations and their statuses.

migrations:run-legacy

php bin/cli.php migrations:run-legacy

Runs legacy migration.

seed:clicks

php bin/cli.php seed:clicks

Seeds clicks.

seed:conversions

php bin/cli.php seed:conversions

Seeds conversions.

system:check_update

php bin/cli.php system:check_update

Shows the current version and lists available updates.

system:generate_config

php bin/cli.php system:generate_config

Generates a new config.ini.php file.

system:optimize_table

php bin/cli.php system:optimize_table

Optimizes database tables.

system:reload_cache

DO NOT RUN THE COMMAND AS ROOT!

php bin/cli.php system:reload_cache 

Reloads cache.

system:restart_roadrunner

php bin/cli.php system:restart_roadrunner 

Reloads road runner.

system:self_update

DO NOT RUN THE COMMAND AS ROOT!

php bin/cli.php system:self_update 

Updates Keitaro.