box4b/systembundle

系统包装包

安装: 127

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

1.0.10 2017-04-25 13:36 UTC

This package is not auto-updated.

Last update: 2024-09-28 20:19:54 UTC


README

使用Symfony事件绑定Linux系统事件(cron,init)。

配置

###AppKernel

将以下内容添加到AppKernel的registerBundles()中

new box4b\SystemBundle\SystemBundle()

###对于Cron

创建一个包含以下内容的/etc/cron.d/box4bsystem文件

* * * * *	[YOUR_USER]	/usr/bin/php [PATH_TO_SYMFONY_PROJECT]/app/console box4b:cron --env=prod > /dev/null 2> /dev/null

###对于Init / Systemd

创建一个文件,调用/usr/bin/php [PATH_TO_SYMFONY_PROJECT]/app/console box4b:init [start|stop]

用法

使用Symfony事件监听器系统监听事件

###Init

  • box4b\SystemBundle\Event\InitEvent::EVENT_START
  • box4b\SystemBundle\Event\InitEvent::EVENT_STOP

###Cron

  • box4b\SystemBundle\Event\CronEvent::EVERY_MINUTE
  • box4b\SystemBundle\Event\CronEvent::EVERY_FIVE_MINUTES
  • box4b\SystemBundle\Event\CronEvent::EVERY_HOUR
  • box4b\SystemBundle\Event\CronEvent::EVERY_DAY
  • box4b\SystemBundle\Event\CronEvent::EVERY_WEEK

享受吧 :)