cakephpscheduled-taskscakephp-2.2windows-2003-webservercakephp-2.3

CakePHP Shell "could not start" from Scheduled task and Windows 2003 Server


I am trying to run a CakePHP Shell script through the Scheduled Task of Windows 2003 server and I'm finding that the task Could not start.

When I run it manually from the Command Prompt it works well:

C:\Inetpub\wwwroot\CakePHP\lib\Cake\Console\cake mail read

The Scheduled task Run field is exactly the same and the Start in is set to:

C:\Inetpub\wwwroot\tickets\app

The Run as field is set as the computer admin which has all permissions (not the ISS user)

Scheduled Task log shows this message when trying to execute it:

"Ticket Mail System.job" (cake) 13/12/2012 07:15:00 ** ERROR **

Unable to start task.

The specific error is:

0x80070005: Access is denied.

It seems it is a permissions problem.

I have tried to give over the lib/Cake/Consol/cake.bat file all permissions for both users, the IIS 6 user and the Internet Guest Account user, but still doesn't work.

Any idea which could be the cause?


Solution

  • It worked well over Windows 7 but it didn't on Window 2003 Server.

    Finally, I tried it adding .bat after calling the Shell and it works.

    I had to put this in the Run field:

    C:\Inetpub\wwwroot\CakePHP\lib\Cake\Console\cake.bat mail read
    

    It seems Windows 2003 needs the .bat at the end...

    I found it at: http://www.geekyboy.com/archives/376