amazon-web-services - How to run wget cron command on elastic beanstalk config
问题描述
I have one instance on elastic Beanstalk.
According to the documentation for running the cron on beanstalk environment I would create a file named something like "mycron.config
" and place it in the .ebextensions folder.
I've done that.
The "mycron.config
" file read like this:
commands:
command: "*/5 * * * * /usr/bin/wget -O /dev/null https://example.com/pull-shopify-orders"
I'm attempting to hit this url every 5 minutes. The cron isn't running. What am I doing wrong?
解决方案
Not sure what documentation you are referring to (no link), but I guess you write about cron.yaml
which is only for worker environments.
To setup cron
on web environments, you have to create /etc/cron.d/mycron
"manually" with proper content and permissions.
This procedure is explained in a very recent AWS blog post:
The blog creates cron-linux.config
with the exemplary content of (modified content for your use-case):
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"
推荐阅读
- node.js - 无法使用 OpenSuse Leap 15.1 中的电子锻造和电子安装程序为目标 win32 构建
- excel - 添加/删除行但仅一次时的VBA消息框
- javascript - 在javascript中给出2个函数的序列
- arrays - 数组没有通过在 excel vba 中使用函数来获取值
- python - 如何通过 FastAPI 后端上的 websocket 连接提供实时数据库更新
- python - gensim.models.docvecs.doctag_syn0norm 的属性错误
- android - 自动连接到父按钮不可见
- python - 使用 Python 请求向本地主机发送 POST 请求
- canvas - 为什么 webgl 画布上下文比 2d 画布使用更多的内存?
- r - 从 R 中的某个列开始将后续列向上移动一个额外的位置(滞后)