red-rocket
red-rocket

Reputation: 162

Does not work zip from exec()

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.

Upvotes: 0

Views: 1381

Answers (1)

CyberDem0n
CyberDem0n

Reputation: 15036

When you run script from shell and from cron you have a different content for a $PATH environment variable. So, I suppose your zip located in some place, which does't included into cron's $PATH.

The very simplest solution is to run zip with specifying full path, for instance /usr/local/bin/zip

Upvotes: 2

Related Questions