Re: Different behaviour : command line / cron

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, April 17, 2007 5:41 pm, mbneto wrote:
> I've developed a simple script that among other things sends a fax
> using
> hylafax's sendfax program.   If I test it calling directly from the
> command
> line it works fine.
>
> If I let it run from cron it executes everything fine except the fax.
>
> I am using the system call and in order to debug I am using the
> following
> code
>
> ...
> $cmd = sprintf('/usr/bin/sendfax -n -d %s %s',$fax,$file) ;
> mail ("myemail@xxxxxxx", "fax", $cmd."\n".system($cmd));

Use exec() instead of system, and get the $error number, and use
perror on the command line to find out what went wrong.

cron runs in a different environment, and my first guess is that it
doesn't have access to /tmp/fax.txt, but that's just a guess.

You may also want to put quotes around "fax_number" in case it has
spaces in it...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux