Run .jsp script in task scheduler

Chamandeep Singh 41 Reputation points


OS = Windows Server 2019

I need to run a .jsp script in task scheduler

Scripts is http://X.X.X.X:8080/DeleteLog/DeleteLog.jsp

In task scheduler, under start a program option tab,

There are three fields - I am trying these options

Program/Script - don't know what to use?
Add argument - http://X.X.X.X:8080/DeleteLog/DeleteLog.jsp
Start in - C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\ROOT\DeleteLog

Can someone please tell me what will come in the Program/Script option

or what is correct process to run a .jsp file in task scheduler

Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,537 questions
0 comments No comments
{count} votes

Accepted answer
  1. MotoX80 32,441 Reputation points

    You cannot run a web page in the task scheduler. You need to run an executable program, like cscript.exe or cmd.exe, or java.exe, or perl.exe, or any other .exe. These are typically command line programs. You can run a GUI program but they normally expect to interact with a user who will "click on OK to continue" and don't always work well when run as a task.

    Now, you can run a script to invoke a web page. Powershell has Invoke-webrequest.

    You would need to write a .ps1 script to call the page, The program is Powershell.exe and the argument is the full path to the .ps1 script file. Note that the .jsp page will execute in the memory of whatever server hosts the web site. That is not necessarily the same machine that is running the task. It could be, but the Powershell script is not going to magically invoke a remote jsp on the local machine that runs the task.

    A jsp page expects to be invoked within the context of an HTTP request between a client and a server. A Task Scheduler task is essentially a command line environment. They are not the same.

    Based on the name, if the .jsp purges Tomcat logs from the remote web server, then a Powershell .ps1 which does an Invoke-WebRequest should work for you. I would expect the page to require authentication, so you will need to add in credentials on the call.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Limitless Technology 39,461 Reputation points

    Hello @Chamandeep Singh

    Program/Script - your .jsp file http url or path of .jsp file.

    Add argument : <Leave blank >

    Start in - C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\ROOT\DeleteLog

    Thank you,

    0 comments No comments