json - 如何将动态日期戳添加到由 Bash cron 发送的 JSON 有效负载?
问题描述
我有一个 .sh 脚本,它将由 cron 每天执行一次,它将发送一个 curl 请求,如下所示:
curl -u username_here --header "Content-Type: application/json" --data @JSON_FILE_NAME_HERE "http://URL_LISTED_HERE"
json 文件包含以下示例数据:
{
"name" : "TEST",
"start_date" : "2021-03-22T13:00:00.000Z",
"end_date" : "2021-03-22T00:45:00.000Z",
"operators" : "OR",
"recurrence" : "",
"user" : "username_here",
"subsets" : [
{
"subset1" : [
"hostname",
"isoneof",
[
"test1.com",
"test2.com",
"test3.com"
]
]
}
]
}
有没有办法让 'start_date' 和 'end_date' 在 cron 运行时自动生成,所以 'start_date' 是当前时间,而 'end_date' 是从当前时间开始的一小时?
解决方案
推荐阅读
- c - “[Error] 二进制 + 的无效操作数(具有 'float' 和 'float *')” 是什么意思
- c++ - 在 C++ 中基于 for 循环的范围内更新类成员值
- java - 将结果存储在变量中
- flutter - 如何更新 Stream 上的项目
- > 带流
? - java - Libgdx 中的 SpriteBatch 偏移
- c# - Linq .net core 3.1 从“VisitLambda”调用时,重写“System.Linq.Expressions.ParameterExpression”类型的节点必须返回
- youtube - YouTube Data API:请求无法完成,因为您已超出配额。Сan 我是否使用 YouTube 数据 API 制作应用程序?
- node.js - 如何让路由在共享托管空间上工作
- javascript - 如何根据 getElementByClassName 过滤数组
- pandas - 基于 df1 的列的查找值对应于 df2 中的匹配值(请先阅读正文)