All Projects β†’ virgilwashere β†’ mautic-cron-commands

virgilwashere / mautic-cron-commands

Licence: GPL-3.0 license
Script to run Mautic commands from a web page.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to mautic-cron-commands

mi-cron
πŸ“† A microscopic parser for standard cron expressions.
Stars: ✭ 16 (-50%)
Mutual labels:  cron, cron-jobs
Tiktok
Python web visualize build on the awesome web framework sanic
Stars: ✭ 55 (+71.88%)
Mutual labels:  cron, cron-jobs
Wipe Modules
πŸ—‘οΈ Easily remove the node_modules folder of non-active projects
Stars: ✭ 304 (+850%)
Mutual labels:  cron, cron-jobs
cli
Aplus Framework CLI Library
Stars: ✭ 104 (+225%)
Mutual labels:  console, cron
EasyCronJob
This repository provides easy cron job to your application on IHostedService.
Stars: ✭ 66 (+106.25%)
Mutual labels:  cron, cron-jobs
nodejs-cron-job-must-know
it is an example of running node.js script with every certain period(cron job)
Stars: ✭ 35 (+9.38%)
Mutual labels:  cron, cron-jobs
Chronos
Fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules
Stars: ✭ 4,303 (+13346.88%)
Mutual labels:  cron, cron-jobs
Healthchecks
A cron monitoring tool written in Python & Django
Stars: ✭ 4,297 (+13328.13%)
Mutual labels:  cron, cron-jobs
Crontabmanager
PHP library for GNU/Linux cron jobs management.
Stars: ✭ 113 (+253.13%)
Mutual labels:  cron, cron-jobs
Cronscheduler.aspnetcore
Cron Scheduler for AspNetCore 2.x/3.x or DotNetCore 2.x/3.x Self-hosted
Stars: ✭ 100 (+212.5%)
Mutual labels:  cron, cron-jobs
Laravel Totem
Manage Your Laravel Schedule From A Web Dashboard
Stars: ✭ 1,299 (+3959.38%)
Mutual labels:  cron, cron-jobs
cronex
A cron like system built in Elixir, that you can mount in your supervision tree
Stars: ✭ 43 (+34.38%)
Mutual labels:  cron, cron-jobs
fastify-cron
Run cron jobs alongside your Fastify server πŸ‘·
Stars: ✭ 32 (+0%)
Mutual labels:  cron, cron-jobs
magento2-module-cron-schedule
A Magento2 visual cronjob overview for magento2 backend
Stars: ✭ 35 (+9.38%)
Mutual labels:  cron, cron-jobs
progress-bar-log
A component to display a progress bar and last X logs at the same time.
Stars: ✭ 44 (+37.5%)
Mutual labels:  console
samples
Sample smart contract apps for Xooa PaaS.
Stars: ✭ 19 (-40.62%)
Mutual labels:  console
executor
A powerful "short-cutter" to your console to you and your team!
Stars: ✭ 21 (-34.37%)
Mutual labels:  console
server-next
😎 The next generation of RESTful API service and more for Mix Space, powered by @nestjs.
Stars: ✭ 43 (+34.38%)
Mutual labels:  cron
er-console
ιšζœΊζ‰“ε°ζΆζžδΏ‘ζ―
Stars: ✭ 24 (-25%)
Mutual labels:  console
hyperapp-logger
Log Hyperapp state updates and action information to the console.
Stars: ✭ 48 (+50%)
Mutual labels:  console
author date version copyright license link
2019-10-20
0.1.6
2019 Virgil
All rights reserved
GPL3

Mautic

Mautic cron commands

commands.php can be used in environments where you do not have SSH access to run the Mautic command line tool: app/console.

Requirements β˜‘οΈ

  • a Mautic installation
    • works with Mautic 2.12+
  • a webserver with PHP support

Installation πŸš€

⚠️WARNING
DO NOT leave the $secretphrase as mautibot_happy

  1. πŸ”½οΈ Download [commands.php] (or clone the repo)

  2. ✏️Edit your local copy of [commands.php]

    1. πŸ” Change the $secretphrase parameter in the script to a new secret phrase so only you will be able to run the commands.
    2. 🎨 Optional: replace $logo with another <img src= link.
  3. 🐦Copy your modifed commands.php to the root folder of your Mautic installation via SSH terminal, (s)FTP upload or carrier pigeon.

    ℹ️ NOTE
    This is the same level as Mautic's LICENSE.txt file and the directory app/

nginx config for shared vhosts

Add this to the server block for the vhost.

server {
    #server_name      mautic.example.com;
    #...

    set $mautic_root /var/www/vhost1/mautic;
    include snippets/mautic_cron.conf;
}

snippets/mautic_cron.conf

    location /cron/ {
        # URL would be https://mautic.example.com/cron/commands.php
        root    $mautic_root;
        index   commands.php;

        location ~ /(commands|import)\.php(/|$) {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php7.2-fpm.sock;

            #override SCRIPT_FILENAME
            fastcgi_param  SCRIPT_FILENAME $request_filename;
            fastcgi_param  HTTP_PROXY   "";
            fastcgi_read_timeout        600;
            fastcgi_buffers             16 16k;
            fastcgi_buffer_size         32k;
            fastcgi_intercept_errors    on;
            fastcgi_param  MAUTIC_ROOT  $mautic_root;
        }
    }

How to use 🚴

mautibot

When you open the URL, you are presented with a list of available commands. You can click on those to run the command, or use the Encoded URL link to a specific command in a cronjob/scheduler service, like Jenkins CI/CD.

πŸ‘ͺ Interactively

  1. 🌐 Open the commands.php URL with your browser

    https://mautic.example.com/commands.php?mautibot_happy
  2. ❔ Optional. Append &pretty to the URL to display a logo and basic navigation

     https://mautic.example.com/commands.php?mautibot_happy&pretty

pretty-list

command list
$allowedCmds = array(
    'list',
    'mautic:segments:update',
    'mautic:campaigns:update',
    'mautic:campaigns:trigger',
    'cache:clear',
    'mautic:emails:send',
    'mautic:emails:fetch',
    'mautic:emails:send --quiet',
    'mautic:emails:fetch --quiet',
    'mautic:broadcasts:send',
    'mautic:broadcasts:send --quiet',
    'mautic:broadcasts:send --channel=email',
    'mautic:broadcasts:send --channel=sms',
    'mautic:messages:send',
    'mautic:campaigns:messages',
    'mautic:campaigns:messages --channel=email',
    'mautic:campaigns:messages --channel=sms',
    'mautic:queue:process',
    'mautic:webhooks:process',
    'mautic:reports:scheduler',
    'mautic:plugins:update',
    'mautic:iplookup:download',
    'mautic:assets:generate',
    'mautic:segments:update --force',
    'mautic:campaigns:update --force',
    'mautic:campaigns:trigger --force',
    'mautic:segments:update --max-contacts=300 --batch-limit=300',
    'mautic:segments:update --max-contacts=300 --batch-limit=300 --quiet',
    'mautic:segments:update --max-contacts=300 --batch-limit=300 --force',
    'mautic:segments:update --max-contacts=1000 --batch-limit=1000',
    'mautic:segments:update --max-contacts=1000 --batch-limit=1000 --quiet',
    'mautic:campaigns:update --max-contacts=100 --quiet',
    'mautic:campaigns:update --max-contacts=300 --quiet',
    'mautic:campaigns:trigger --quiet',
    'cache:clear --no-interaction --no-warmup --no-optional-warmers',
    'cache:warmup --no-interaction --no-optional-warmers',
    'mautic:social:monitoring',
    'mautic:integration:pushleadactivity --integration=XXX',
    'mautic:integration:fetchleads --integration=XXX',
    'mautic:import --limit=600',
    'mautic:import --limit=600 --quiet',
    'mautic:dnc:import --limit=600',
    'mautic:dnc:import --limit=600 --quiet',
    'mautic:maintenance:cleanup --no-interaction --days-old=90 --dry-run',
    'mautic:maintenance:cleanup --no-interaction --days-old=365 --dry-run',
    'mautic:maintenance:cleanup --no-interaction --days-old=90',
    'mautic:maintenance:cleanup --no-interaction --days-old=365',
    'doctrine:migrations:status',
    'doctrine:migrations:status --show-versions',
    'doctrine:migrations:migrate --allow-no-migration --dry-run',
    'doctrine:migrations:migrate --allow-no-migration --no-interaction',
    'doctrine:migrations:migrate --allow-no-migration --query-time --dry-run',
    'doctrine:migrations:migrate --allow-no-migration --query-time --no-interaction',
    'doctrine:schema:update',
    'doctrine:schema:update --dump-sql',
    'doctrine:schema:validate',
    'doctrine:schema:update --no-interaction --dump-sql --force',
    'doctrine:schema:update --no-interaction --force',
    'debug:swiftmailer',
    'debug:router',
    'doctrine:mapping:info',
    'debug:event-dispatcher',
    'mautic:install:data --no-interaction --force',
    'mautic:contacts:deduplicate',
    'mautic:unusedip:delete',
    'mautic:dashboard:warm',
    'mautic:campaign:summarize',
    'mautic:update:find',
    'mautic:update:apply --no-interaction --force',
);

Cron jobs πŸ•–

  1. πŸ”Ž Find the URL encoded link to a command

    https://mautic.example.com/commands.php?mautibot_happy&task=mautic%3Acampaigns%3Atrigger
  2. 🌐 Request the URL

    # min hr dom mth dow  command
    */15  *  *   *   *    curl -L http://mautic.example.com/commands.php?mautibot_happy&task=mautic%3Acampaigns%3Atrigger
    

    πŸ’‘ ProTip
    curl can also use this syntax:
    curl -L 'http://mautic.example.com/commands.php?mautibot_happy&task=mautic:campaigns:trigger'

πŸ”° Basic output

The output from the script will be sent to the browser so you can see the results just as if you ran this console command from the shell.

Executing console mautic:campaigns:trigger
 Triggering events for campaign 1
 Triggering events for newly added contacts
 2 total events(s) to be processed in batches of 100 contacts
  0/2 [>---------------------------]   0%
  2/2 [============================] 100%
 2 total events were executed
 0 total events were scheduled

 Triggering scheduled events
 0 total events(s) to be processed in batches of 100 contacts

 0 total events were executed
 0 total events were scheduled

 Triggering events for inactive contacts

 0 total events were executed
 0 total events were scheduled

πŸ’ Pretty output

pretty format campaign trigger

pretty format migrations status

Mautic logo

Mautic documentation πŸ“œ

ℹ️ NOTE
Access the complete Mautic documentation here.

mautibot

Related projects ⛅️

Changelog πŸ“”

See CHANGELOG

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].