0

I have php script that is run from cron. There are such command as

zip -j9 {targer_some_directory}/all.zip {some_directory}/pdf/*.pdf 

in that script.

This command is running by exec();

{some_directory} and {targer_some_directory} are existing full path. These directories have rights = 0777. When I run this script from shell it works. When it run from cron, script doesn't work.

Can anybody help me?

P.S. Sorry for my bad English.

4

1 回答 1

2

shell当您从和从您运行脚本时,环境变量cron的内容会有所不同。$PATH所以,我想你的 zip 位于某个地方,它不包含在 cron 的 $PATH 中。

最简单的解决方案是运行 zip 并指定完整路径,例如/usr/local/bin/zip

于 2012-08-15T05:35:33.370 回答