Консольные команды
Как получить доступ к консольным командам
Для того, чтобы получить доступ к консольным командам, нужно выполнить вход в сам трекер на сервере:
cd /var/www/keitaro
Дополнительная информация по команде
sudo -u keitaro php bin/cli.php command_name --help
Полный список команд
Весь актуальный список команд, можно посмотреть запустив через консоль:
sudo -u keitaro 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:change-password Change admin user password 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:delete_all_stats Clear disk space by deleting stats 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
sudo -u keitaro php bin/cli.php 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: sudo -u keitaro php bin/cli.php help list You can also output the help in other formats by using the --format option: sudo -u keitaro php bin/cli.php help --format=xml list To display the list of available commands, please use the list command.
list
sudo -u keitaro php bin/cli.php list
Выводит список доступных команд.
macros
sudo -u keitaro php bin/cli.php 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
sudo -u keitaro php bin/cli.php admin:create <login> <password>
Создает нового админа.
admin:change-password
sudo -u keitaro php bin/cli.php admin:change-password insert_new_password_here
Создает новый пароль для admin.
Admin API
sudo -u keitaro php bin/cli.php admin_api:routes
Выводит список доступных команд для Admin API.
+--------+-----------------------------------------------+------------------------------------------------------------------+ | 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
НЕ ЗАПУСКАЙТЕ КОМАНДУ ОТ ROOT!
sudo -u keitaro php bin/cli.php bots:import
Импортирует список ботов.
cron
НЕ ЗАПУСКАЙТЕ КОМАНДУ ОТ ROOT!
sudo -u keitaro php bin/cli.php cron:run
Запускает cron.
db:dump_schema
sudo -u keitaro php bin/cli.php db:dump_schema
Делает дамп схемы базы.
db:migrate
НЕ ЗАПУСКАЙТЕ КОМАНДУ ОТ ROOT!
sudo -u keitaro php bin/cli.php db:migrate
Запускает все миграции.
db:seed
sudo -u keitaro php bin/cli.php db:seed
Добавляет данные в базу.
db:setup
sudo -u keitaro php bin/cli.php db:setup
Создает новую базу и импортирует schema.sql и tables.sql.
geodbs:list_updates
sudo -u keitaro php bin/cli.php geodbs:list_updates
Выводит список обновлений гео-баз.
geodbs:update
sudo -u keitaro php bin/cli.php geodbs:update <db-id>
Обновляет определенную гео-базу.
geodbs:update_all
sudo -u keitaro php bin/cli.php geodbs:update_all
Обновляет все гео-базы.
migrations:create
sudo -u keitaro php bin/cli.php migrations:create
Создает новую миграцию.
migrations:list
sudo -u keitaro php bin/cli.php migrations:list
Выводит список миграций и их состояние.
migrations:run-legacy
sudo -u keitaro php bin/cli.php migrations:run-legacy
Запускает неиспользуемые миграции.
seed:clicks
sudo -u keitaro php bin/cli.php seed:clicks
Обрабатывает клики.
seed:conversions
sudo -u keitaro php bin/cli.php seed:conversions
Обрабатывает миграции.
system:check_update
sudo -u keitaro php bin/cli.php system:check_update
Выводит текущую версию и список доступных обновлений.
system:delete_all_stats
sudo -u keitaro php bin/cli.php system:delete_all_stats
Удаляет статистику и очищает места на диске.
После запуска команды вы получите предупреждение о том, что произойдет и какая информация очистится:
[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.
Далее подтвердите выполнение команды (yes/no).
Будет произведена очистка статистики.
system:generate_config
sudo -u keitaro php bin/cli.php system:generate_config
Генерирует новый файл config.ini.php.
system:optimize_db
sudo -u keitaro php bin/cli.php system:optimize_db
Оптимизирует таблицы в базе данных.
system:reload_cache
НЕ ЗАПУСКАЙТЕ КОМАНДУ ОТ ROOT!
sudo -u keitaro php bin/cli.php system:reload_cache
Перезагружает кэш.
system:restart_roadrunner
sudo -u keitaro php bin/cli.php system:restart_roadrunner
Перезагружает road runner.
system:self_update
НЕ ЗАПУСКАЙТЕ КОМАНДУ ОТ ROOT!
sudo -u keitaro php bin/cli.php system:self_update
Обновляет Keitaro.