cron job debian亚马逊ec2实例错误

时间:2014-04-11 12:53:48

标签: shell amazon-ec2 cron phpunit npm

cron job debain amazon ec2 instatance error

我的cron作业运行一个脚本 这给了我一个错误

   phpunit: not found
   npm: not found

它们已经安装在系统中

   root@:~# phpunit --version
   PHPUnit 4.0.14 by Sebastian Bergmann.

   root@:~# npm --version
   1.3.17

但如果我尝试像

一样运行脚本
 sh /pth/to/file.sh 

我完美运行OKK

但在CRON JOB中,我给了我一个错误

1 个答案:

答案 0 :(得分:1)

如评论中所示,使用脚本的完整路径是一个问题:

你得到了

  

phpunit:找不到     npm:未找到

因为你可能正在调用像

这样的函数
phpunit blabla

由于cronjob确实具有减少的环境,因此通常需要指定整个路径。要获得它们,请which phpunit。并相应地使用输出:

/bin/phpunit blabla