A new kernel shell command has been provided in the release of emergence v1.0.7 that makes it easy to fire events from the host’s command line. Events are fired within the site via the PHP-FPM interface and so benefit from the hot cache any site may have.
The command will work for any user that has read access to /emergence/services/run/php-fpm/php-fpm.sock
, so by default this means root
or any user in the www-data
group.
Basic usage
$ emergence-fire-event mysite myevent MyApp/Context
Passing arbitrary key/value pairs in event payload
$ emergence-fire-event mysite myevent MyApp/Context --foo=bar --boo=baz --imtrue
Using in a cron script
/etc/cron.d/example
:
* * * * * root /usr/local/bin/emergence-fire-event mysite everyMinute MyApp/Context --send-emails