Lunarpages Web Hosting Forum

Author Topic: Scheduled Task problem  (Read 16371 times)

Offline grante

  • Newbie
  • *
  • Posts: 3
Re: Scheduled Task problem
« Reply #15 on: May 30, 2007, 06:59:14 PM »
I had a similiar problem on my website.
This is a solution from customer support:

You can not schedule a web page to be run at a specified time. The task scheduler can only handle files that are executable, such as cgi files or files with a .exe extension. In order to use the scheduler to run a task at a predefined time you will need to compile the file as either a cgi file or an executable file and then upload it into the cgi bin folder.

Offline Comet Software

  • Spacescooter Operator
  • *****
  • Posts: 40
Re: Scheduled Task problem
« Reply #16 on: July 12, 2009, 06:11:10 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.

This looks like something I want to do, but, I have never used VB scripts.  In my case I will be wanting to launch different ASP.NET files at different times.  So, is it possible to modify the script above so that it takes a command line parameter of the actual ASP.NET file that I would want to run?  And, does Lunarpages Scheduler accept/run that type of setup?
« Last Edit: July 16, 2009, 01:06:06 PM by Comet Software »