Cron: Setting PATH from shell script not working

This question already has an answer here:

  • Getting the source directory of a Bash script from within 50 answers

  • A cron job runs in the owner's home directory, so that's what pwd results in when it runs. Just put the directory you want instead.

    PATH=$PATH:/vagrant
    

    Incidentally, you can't (reliably) use the Bash syntax export variable=value because Cron runs plain sh . Anyway, there should be no need to export the PATH variable, because it is already exported, inherently (it couldn't work if it wasn't).

    链接地址: http://www.djcxy.com/p/9750.html

    上一篇: 从它所在的目录运行Shell脚本

    下一篇: Cron:从shell脚本设置PATH不起作用