Re: Different behaviour : command line / cron

From: Date: Wed, 18 Apr 2007 06:27:21 +0000
Subject: Re: Different behaviour : command line / cron
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-253173@lists.php.net to get a copy of this message
# mbneto@gmail.com / 2007-04-17 18:41:46 -0400: > Hi, > > 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@foo.com", "fax", $cmd."\n".system($cmd)); > ... try with $cmd = sprintf( '/usr/bin/sendfax -n -d %s %s 2>&1', escapeshellarg($fax), escapeshellarg($file) ); exec($cmd, $out, $rv); $body = sprintf( "command: %s\nstatus: %d\noutput:\n%s\n", $cmd, $rv, implode("\n", $out) ); mail("myemail@foo.com", "fax", $body); -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991

« previous php.general (#253173) next »