代码之家  ›  专栏  ›  技术社区  ›  Axel

ubuntu crontab simple echo to file不工作

  •  0
  • Axel  · 技术社区  · 7 年前

    我试图在ubuntu上为日常任务设置一些cronjobs。为此,我添加了例如

    25 11 * * * ~/test_script.sh
    

    sudo crontab -e 桌子。在 test_script.sh 我正在尝试对这样的日志文件进行简单的响应:

    #!/bin/bash
    # file: test_script
    
     echo "Test" >> ~/test.log
    

    当我运行脚本时,通常会添加一行“test” test.log 是的。但是在11点25分似乎什么也没发生。我已经检查过时间设置是否正确 echo $(date) 是的。

    我错过了什么?

    1 回复  |  直到 7 年前
        1
  •  1
  •   Senior Pomidor    7 年前

    应该粘贴脚本的完整路径。例如 25 11 * * * /home/xxxx/test_script.sh