Amazon web services 如何在弹性beanstalk配置上运行wget cron命令
我有一个关于弹性豆茎的例子。 根据在beanstalk环境中运行cron的方法,我将创建一个名为“Amazon web services 如何在弹性beanstalk配置上运行wget cron命令,amazon-web-services,cron,amazon-elastic-beanstalk,Amazon Web Services,Cron,Amazon Elastic Beanstalk,我有一个关于弹性豆茎的例子。 根据在beanstalk环境中运行cron的方法,我将创建一个名为“mycron.config”的文件,并将其放在.ebextensions文件夹中 我已经做到了。 “mycron.config”文件如下所示: commands: command: "*/5 * * * * /usr/bin/wget -O /dev/null https://example.com/pull-shopify-orders" 我正在尝试每5分钟点击一次这个url。 cro
mycron.config
”的文件,并将其放在.ebextensions文件夹中
我已经做到了。
“mycron.config
”文件如下所示:
commands:
command: "*/5 * * * * /usr/bin/wget -O /dev/null https://example.com/pull-shopify-orders"
我正在尝试每5分钟点击一次这个url。
cron没有运行。我做错了什么?不确定您指的是什么文档(没有链接),但我猜您写的是只针对工作环境的
cron.yaml
要在web环境中设置cron
,您必须使用适当的内容和权限“手动”创建/etc/cron.d/mycron
AWS最近的一篇博客文章对此过程进行了解释:
cron linux.config
,其中包含示例性内容(针对您的用例修改的内容):
嗨,谢谢你的回答是的,我指的就是这个。这就是我所看到的,但我想问的是,如何设置wget来访问外部链接@Marcin我会在#您的实际脚本内容中插入“*/5****/usr/bin/wget-O/dev/null”吗?@FabricioG我修改了示例以更接近您的用例。您太棒了Marcin谢谢@马辛
files:
"/etc/cron.d/mycron":
mode: "000644"
owner: root
group: root
content: |
*/5 * * * * root /usr/local/bin/myscript.sh
"/usr/local/bin/myscript.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash
#date > /tmp/date
/usr/bin/wget -O /dev/null https://example.com/pull-shopify-orders
exit 0
commands:
remove_old_cron:
command: "rm -f /etc/cron.d/mycron.bak"