我正在使用Bref (使用无服务器)在AWS Lambda上运行Symfony 4 (PHP)应用程序。
Bref为Symfony的bin/console二进制文件提供了一个层。Lambda函数的无服务器配置如下所示:
functions:
console:
handler: bin/console
name: 'mm-console'
description: 'Symfony 4 console'
timeout: 120 # in seconds
layers:
- ${bref:layer.php-73} # PHP
- ${bref:layer.console} # The "console" layer使用上面的代码,我可以在Lambda上运行vendor/bin/bref cli mm-console -- mm:find-matches来运行bin/console mm:find-matches。
如果我想在Lambda上按计划运行mm:find-matches控制台命令,该怎么办?我试过这个:
functions:
mm-find-matches:
handler: "bin/console mm:find-matches"
name: 'mm-find-matches'
description: 'Find mentor matches'
timeout: 120
layers:
- ${bref:layer.php-73} # PHP
- ${bref:layer.console} # The "console" layer
schedule:
rate: rate(2 hours)但是,"bin/console mm:find-matches“不是有效的处理程序。如何按计划向bin/console函数传递mm:find-matches命令?
发布于 2019-08-14 00:03:48
您可以通过调度事件输入传递命令行参数,如下所示:
functions:
console:
handler: bin/console
name: 'mm-console'
description: 'Symfony 4 console'
timeout: 120 # in seconds
layers:
- ${bref:layer.php-73} # PHP
- ${bref:layer.console} # The "console" layer
events:
- schedule:
input:
cli: "mm:find-matches --env=test"
rate: rate(2 hours)
enabled: true尽管在this bref github issue上有一些关于使用cli控制台应用程序是否是最好的解决方案的讨论,但还是与编写引导内核并执行您希望命令完成的特定任务的函数相比。
https://stackoverflow.com/questions/57480766
复制相似问题