Lunarpages Web Hosting Forum

Author Topic: Scheduled Task problem  (Read 16353 times)

Offline cmosses

  • Space Explorer
  • ***
  • Posts: 9
Scheduled Task problem
« on: March 16, 2007, 09:03:02 PM »
I need to set up a scheduled task on my shared Windows host. The purpose of the task is to run the code in a PHP page on my website. It does not matter how: by loading the page or by running it with php.exe.

However, when I set up the Scheduled Task in Plesk, nothing happens. No notifications are sent, even though I have specified that an email be sent to my email address. I tried setting the "Path to executable" to php, php.exe, C:\php\php.exe but none of them work.

Any ideas how I might accomplish the task? Thanks in advance :-)

Offline manueltrongone

  • Space Explorer
  • ***
  • Posts: 8
Re: Scheduled Task problem
« Reply #1 on: March 18, 2007, 08:28:26 AM »
Hi Cmosses,

It's needed that a new Windows schedule task is created on the windows server with the following parameters:

program to run: Internet Explorer
In the advanced properties (under the run box) it's needed to be type in double quotation : C:\IEpath\IEXPLORE.exe http://www.example.com/example.php

You've also to choose the frequency for the task to be run.

Probably you can resolve the issue open a new ticket in the ticket desk.

Thanks
Manuel

Offline mikemo

  • Spaceship Navigator
  • *****
  • Posts: 97
Re: Scheduled Task problem
« Reply #2 on: March 20, 2007, 06:06:34 PM »
I need to set up a scheduled task on my shared Windows host. The purpose of the task is to run the code in a PHP page on my website. It does not matter how: by loading the page or by running it with php.exe.

However, when I set up the Scheduled Task in Plesk, nothing happens. No notifications are sent, even though I have specified that an email be sent to my email address. I tried setting the "Path to executable" to php, php.exe, C:\php\php.exe but none of them work.

Any ideas how I might accomplish the task? Thanks in advance :-)

Open up a PLESK session, go to the file manager, and browse through to where your executable resides.  the file manager will display the PHYSICAL path where that file resides -- use that to define the path for your executable in the scheduled task string.   i believe that will do it but don't quote me - did the same thing about a month ago to resolve an identical issue (although not with php.exe)


Offline gaslogs3

  • Space Explorer
  • ***
  • Posts: 6
Re: Scheduled Task problem
« Reply #3 on: March 28, 2007, 09:32:26 AM »
Can someone post their exact "path to executable" they are using to load a webpage from their site (or another site).  I have tried every concievable combination with no success.

Thanks

Offline Sumean

  • Trekkie
  • **
  • Posts: 11
Re: Scheduled Task problem
« Reply #4 on: March 28, 2007, 11:08:07 PM »
Like was said previously, go to file manager, and choose "change permissions for file" on the right of your file (it's the yellow lock) to find the path. So for a file called test.asp at my site, it's at (for example):

D:/Inetpub/vhosts/mysite.com/httpdocs/test.asp

Anyway, it doesn't seem to work for me either.. I've tried the following, as suggested by the previous posts in this thread. Would love to get this working as application variables are useless on lunarpages.

"C:/IEpath/IEXPLORE.exe http://www.mysite.com/test.asp"
"D:/Inetpub/vhosts/mysite.com/httpdocs/test.asp"

And I don't get any of the notifications etc either...

Offline gaslogs3

  • Space Explorer
  • ***
  • Posts: 6
Re: Scheduled Task problem
« Reply #5 on: March 29, 2007, 08:37:12 AM »

I talked to support via email and they suggested to try using curl.

I tried curl but that didnt work for me either.

Path to Executable:
curl http://www.mysite.com/myphpfile.php

Has anyone got this working?

Offline Sumean

  • Trekkie
  • **
  • Posts: 11
Re: Scheduled Task problem
« Reply #6 on: March 30, 2007, 12:09:41 AM »
Can you find out more on curl? Is it this: http://au3.php.net/curl ??

btw, I think they've managed to turn on the email notifying with scheduling an hour ago. I've started to receive email notifications for the last hour. Still can't get scheduling to work though.

Offline RichardRay

  • Spaceship Navigator
  • *****
  • Posts: 89
Re: Scheduled Task problem
« Reply #7 on: March 31, 2007, 09:45:58 AM »
You should be able to schedule a PHP file to run on your account using the following settings in Plesk > Scheduler:

Path to executable file *:  "D:\Program Files\SWsoft\Plesk\Additional\Php\php.exe"

Arguments: "D:\inetpub\vhosts\yourdomain.com\httpdocs\folder\misc\script.php"

(You may need to use C:\ instead of D:\ depending on the server you are hosted on.)
Lunarpages Web Hosting
Lunarpages Affiliate Program
FAQs | Tutorials | LP Glossary

Telephone: 1-714-521-8150
24 hour Network Status Line: 1-562-697-8106
Fax: 1-714-521-8195

Offline gaslogs3

  • Space Explorer
  • ***
  • Posts: 6
Re: Scheduled Task problem
« Reply #8 on: April 01, 2007, 07:41:55 AM »
WOW!!!!!!!!!!!!!!!!!

THANKS RICHARDRAY

I can't believe it's working now.  My problem was the path to PHP.  I was using php or c:/php/php.exe.  Neither work.

Funny thing is that I called support a week ago asking them a simple question: "What is the path to PHP on the windows servers".  The supports guys response to me: "I can't tell you that.  That is a custom scripting issue that you will need to post in the forums".  My reply of course was, no it is not.  I just simply need the path to php.  he wouldn't budge. 

THANKS AGAIN.  Works like a charm.

Offline RichardRay

  • Spaceship Navigator
  • *****
  • Posts: 89
Re: Scheduled Task problem
« Reply #9 on: April 01, 2007, 08:53:54 AM »
You're welcome.

I'm glad this helped.  I actually had to search for this because I wasn't sure either.

If you have any other questions, please let us know  :smiling:
Lunarpages Web Hosting
Lunarpages Affiliate Program
FAQs | Tutorials | LP Glossary

Telephone: 1-714-521-8150
24 hour Network Status Line: 1-562-697-8106
Fax: 1-714-521-8195

Offline Sumean

  • Trekkie
  • **
  • Posts: 11
Re: Scheduled Task problem
« Reply #10 on: April 01, 2007, 09:20:31 AM »
Any idea what command to use for asp pages?

Offline RichardRay

  • Spaceship Navigator
  • *****
  • Posts: 89
Re: Scheduled Task problem
« Reply #11 on: April 02, 2007, 01:19:32 PM »
Hiya Sumean,

I see in your previous post that you had the following as the path to your script:
D:/Inetpub/vhosts/mysite.com/httpdocs/test.asp

Windows expects '\' instead of '/' to seperate the folders in the path.  This may cause the ASP not to run, since the path would be considered incorrect.  You may want to try using:
D:\Inetpub\vhosts\mysite.com\httpdocs\test.asp

If this does not work, you may also want to try setting up the cron to run a PHP file as previously described, then call the ASP page from the PHP page that the scheduler is set to run.

Please reply with the results of using these methods.
Lunarpages Web Hosting
Lunarpages Affiliate Program
FAQs | Tutorials | LP Glossary

Telephone: 1-714-521-8150
24 hour Network Status Line: 1-562-697-8106
Fax: 1-714-521-8195

Offline Sumean

  • Trekkie
  • **
  • Posts: 11
Re: Scheduled Task problem
« Reply #12 on: April 03, 2007, 08:37:58 AM »
I've changed it so it's using '\',  so it's like "D:\Inetpub\vhosts\mysite.com\httpdocs\test.asp".. I have this in the 'Path to executable file' textbox, and I get the error sent to me via email:

"The directory name is invalid."

It probably makes sense to put an actual link to an executable file though, so going back to before, I tried:

(path to executable) C:\IEpath\IEXPLORE.exe
(arguments) D:\Inetpub\vhosts\mysite.com\httpdocs\test.asp

however, I don't get any email messages sent when I link to that executable, and the script isn't run.

I had a look into your advice on calling an asp page from a php page, and using D:\Program Files\SWsoft\Plesk\Additional\Php\php.exe as the executable file.... but I'm not exactly sure how to accomplish this (php is pretty new to me).

I made a php file and use some code like: <?php include("test.asp"); ?>, then the results I get back is that it just displays the actual asp code, but doesn't execute it. Which make sense since its not php.

I made a php with an iframe, and put in the test.asp in the iframe, hoping that gets run.. but that doesn't work either. Any ideas? It would be great if there was a D:\Program Files\SWsoft\Plesk\Additional\asp\asp.exe command instead. Php isn't my forte.

Offline pramd

  • Newbie
  • *
  • Posts: 1
Re: Scheduled Task problem
« Reply #13 on: April 11, 2007, 05:15:10 PM »
hi all

yes how we can run ASP scedular task ?

Offline Sumean

  • Trekkie
  • **
  • Posts: 11
Re: Scheduled Task problem
« Reply #14 on: April 18, 2007, 01:13:51 PM »
I've finally worked out a solution for scheduling asp files and thought I may as well share it here.

1. In your path to executable text field, put this in it:

C:\Windows\system32\cscript.exe

2. In your Arguments text field, have something like the below in it (replace mysite.com with your site etc):

D:\inetpub\vhosts\mysite.com\httpdocs\schedule.vbs

Just a note: cscript.exe won't execute an asp file, that's why we can't have D:\inetpub\vhosts\mysite.com\httpdocs\schedule.asp in the arguments field , so we gotta make do with D:\inetpub\vhosts\mysite.com\httpdocs\schedule.vbs . What's in this schedule.vbs file?

3. It's a script which uses the xmlhttp request to open a webpage. Copy and paste the below and save it as schedule.vbs and place it up on the site.

Call Schedule()

Sub Schedule()

        On Error Resume Next

        'Declare variables
        Dim objRequest
        Dim URL

        Set objRequest = CreateObject("Microsoft.XMLHTTP")

        'this is the asp script that you want to be run
        URL = "http://www.mysite.com/scheduledtasks.asp"

        'Open the HTTP request and pass the URL to the objRequest object
        objRequest.open "POST", URL , false

        'Send the HTML Request
        objRequest.Send

        'Set the object to nothing
        Set objRequest = Nothing

End Sub

4. Now you have to have the asp page which does whatever task you need done. It's named here as scheduledtasks.asp and needs to be placed up on the site.