创建“at”从命令行进行 MYSQL 查询的作业

发布于 2024-09-29 20:34:33 字数 309 浏览 2 评论 0原文

我想从命令行创建一个 at 作业来运行 mysql 查询。正如你可以想象的那样,在 google 或 stackoverflow 上搜索“at”是很困难的。

这工作正常,查询运行得像应该的那样:

mysql -e 'MY QUERY;'

但如果我这样做:

at 17:30 mysql -e 'MY QUERY;'

在 5:30 我收到一封邮件,告诉我“更新:找不到命令”,并且查询不会运行。我已经设置了一个 .my.cnf 文件。还有什么我忘记的吗?

From the command line, I want to create an at job to run a mysql query. As you can imagine searching on google or here stackoverflow for "at" is difficult.

This works fine and the query runs like it ought to:

mysql -e 'MY QUERY;'

but if I do this:

at 17:30 mysql -e 'MY QUERY;'

At 5:30 I get a mail that tells me "UPDATE: command not found" and the query doesn't run. I set up a .my.cnf file already. Is there something else I'm forgetting?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无妨# 2024-10-06 20:34:33

我相信你有一个 shell escape 问题。 shell 可能会吃掉引号。尝试像这样使用双引号:

at 17:30 mysql -e "\"MY QUERY;\""

I believe you have a shell escape issue. The shell is likely eating the quotes. Try double quoting like so:

at 17:30 mysql -e "\"MY QUERY;\""
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文