View Single Post
Old 02-13-2013, 04:21 PM   PM User | #3
Raphael
New Coder

 
Join Date: Mar 2009
Posts: 70
Thanks: 3
Thanked 3 Times in 3 Posts
Raphael is an unknown quantity at this point
Quote:
Originally Posted by Fou-Lu View Post
What's the $retval giving you back? I'd assume that schtasks would return 0 on success.
The entire purpose has me a bit confused though. You schedule to run once notepad and launch a file, which you then write to with the information about the task. That seems a bit pointless IMO.
The $out should contain the output of the call, which is nothing (erm, I think its nothing). When you've redirected the output to the file, the stdout won't have anything in it to present back to PHP. So that cannot be used to determine if it was successful.
0-byte file would say either it doesn't find the task, or that there is no permissions to write. In either case I would actually expect that the $out would contain that, but its possible that you may need to redirect the stderr to the stdout as well.

Windows web servers are such a nightmare to work with :/
I apologize, I copied & pasted the wrong line for the $fname. It's supposed to be repost_labor.bat, not repost_labor.txt. I corrected it above. It should've been:

PHP Code:
$fname 'd:\scripts\labor\scheduled\repost_labor.bat'
This is how $out looks:
Code:
$out => Array (0)
(
)
and $retval has a value of:

Code:
1
When I run the .bat file from the command line it works.
Raphael is offline   Reply With Quote