【问题标题】:chmod for run file [duplicate]运行文件的 chmod [重复]
【发布时间】:2017-02-05 20:01:58
【问题描述】:

对不起,但我会一点英语:),谢谢帮助。 Bash 我需要删除 90 天前的数据并保存数据删除

下一步> 条件 crontab -e

* * * * * /root/file.sh >> /root/textsh.txt

Result : cat textsh.txt
         []

我学习shell,cron,other但是,我专心学习希望成为优秀的程序员

chmod +x file.sh

【问题讨论】:

  • Cron 作业输出在 /root/textsh.txt 文件中重定向,但您正在检查 text.txt。您应该检查textsh.txt 中的输出而不是text.txt 中的输出
  • 很抱歉,打印错误,我会检查 textsh.txt 但没有数据
  • 尝试将 cron 作业更改为 * * * * * /root/file.sb >> /root/textsh.txt 2>&1,以便错误消息也记录到文本文件中。
  • 我尝试了,所以结果 bin/sh: /root/file.sb: 没有这样的文件或目录。你能帮我吗
  • /bin/sh: /root/file.sh: 权限被拒绝

标签: mysql shell cron


【解决方案1】:

你检查/root/file.sh 的执行权限了吗?如果它不可执行,你最终会得到一个零字节的 /root/textsh.txt 文件。

在命令提示符下运行 /root/file.sb,然后将其放在 cron 上。此外,最好将 cronjob 的错误发送到单独的文件中。

【讨论】:

  • 我会试试 TT 我是新手+
  • 没关系 谢谢回答 chmod +x file.sh
猜你喜欢
  • 2011-12-27
  • 1970-01-01
  • 2013-07-14
  • 2021-03-29
  • 1970-01-01
  • 2012-12-05
  • 2016-02-25
  • 2017-06-14
  • 2012-09-19
相关资源
最近更新 更多