search

Home  >  Q&A  >  body text

linux - crontab无法自动执行脚本

设置好crontab之后无法自动执行脚本
经过几次测试之后,发现echo等命令可以生效,但设置执行脚本则不会生效。

  1. crontab设置如图时可以生效:

  1. 当我把crontab设置改成如下是却未生效(直接执行 test.sh 没有问题):

  1. 看了有的回答,将配置改为如下形式仍然未生效:

感谢大家的帮助~!

ringa_leeringa_lee2810 days ago734

reply all(2)I'll reply

  • 阿神

    阿神2017-04-17 14:53:49

    ~Replace with absolute path

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 14:53:49

    I just encountered this problem a few days ago
    It may be that there is output in your sh file
    causing the script to automatically exit after a few seconds

    The solution is to remove all output from the script
    Let the script not have any output

    reply
    0
  • Cancelreply