如何将所有 bash 环境变量传递给 cron
给定的 crontab 条目会出现错误,原因是它无法从 bash 读取所有环境变量。我想知道如何将所有这些信息传递给 cron
A given crontab entry gives errors and the reason is that it can not read all env variables from bash. I wonder how could I pass all this info to cron
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我过去使用过的一个技巧是为特定用户打开一个 bash 会话,然后键入:
您可以从 cron 脚本中获取此文件(或者直接从 crontabs 中获取,如果您正在运行可执行文件) t 改变),类似于:
这当然是使用热核弹头杀死一只苍蝇。您确实应该确定脚本所需的最低限度,然后使用它。
One trick I've used in the past is to open up a bash session for the specific user and just type:
You can this source this file from your cron scripts (or directly from the crontabs if you're running an executable you can't change) with something like:
This is, of course, using a thermonuclear warhead to kill a fly. You should really identify the bare minimum that your script requires and just use that.