Link to home
Start Free TrialLog in
Avatar of billy21
billy21

asked on

Executing an overnight process

I have been asked to design a process that will be executed at a given time and take several hours to complete.  What is the best way to go about this in a web based application.  I'll be writing in VB .Net and am guessing this needs to be executed from the web server as our application is an ASP .net intranet application.  The server side stuff is written in VB .Net.

Would the best way be to create a standard exe file and set it up as a service in windows?  If so can this be done programatically as not to complicate the installation process of the application?  We have many clients using the software.

Thanks in advance,

Billy
Avatar of rdrunner
rdrunner

Hello!

Its not really possible to setup a ASP page to execute a process at a given time. Since the page could not be called that night and this would not start the process.

If you have a SQL Server you could create a Job that runs every night and let this job execute the task you need to do. Another option would be to scedule a job with the windows "Planed tasks" (Only have a german windows here so it might be slightly of)

To add a task to the planed tasks you can goto Start - > system control -> Planed tasks and add one manually.

Another way would be to execute the AT command at the server in question (Can be done remotely if you have suffcient rights)

If you run the planed task be aware that the process wont have your logon token, but it will (by default) use the local system account

Avatar of billy21

ASKER

Guten Tach rdRunner,

Sorry for not being clear.

I intend to do as you suggest.  I will create an exe file using VB .Net and have it executed from a service.  However, i'd like to have the exe file automatically set itself up as a service to execute at a given time.

Thanks,

Bill
Avatar of billy21

ASKER

I should be able to achieve this through API calls right?
Moin Moin!

Well if you write a service then you write a programm that allways runs. So i guess its not really what you want. If you want to execute a specific exe at 1 AM every day then you should scedule the job. There is no reason to have your exe running all the time.

What kind of setup would your exe need and does it need to access any network resources?

Btw are you german? If yes i will post the future path in the OS in german to reduce mixups :)
Avatar of billy21

ASKER

exe will need to access a number of dlls that will always be present on the web server.  It also needs to access the database server (sql server).

I guess I should use project type windows application rather than service then.

>Btw are you german?
Nine.  I can do little more than count and greet in Deutche ;-)
Avatar of billy21

ASKER

woops, that should of course be Deutsche.
Well console application should do. You dont really need an interface for this application?

Just make sure you log all errors and the application wont hang for any reason. If your application needs to access the (local?) SQL Server you need to make sure the local system account will have access to the server or you need to use SQL-Auth. to open the connection. The DLLs should be no problem since they are local. There will be no interface for your application unless you specify so (use "Interactive" when you set up the job with AT so you can see the console output)
Avatar of billy21

ASKER

Actually I do need a UI for the app.  The UI will allow the user to configure such things as the time of execution.  I don't want to complicate our installation process by requiring the user to set up the scheduled job.  I want the application to do that itself.  That way all the user must do is open the app, enter a time for the schedule and close the app.  This should be possible through API calls.
Avatar of billy21

ASKER

Actually forget the UI.  I will set it up to launch at midnight every night.  If anybody wants to change it they can do so through the OS.  However, I still want the application to create its own scheduled job.  that way the installation process is as simple as executing the application.
ASKER CERTIFIED SOLUTION
Avatar of rdrunner
rdrunner

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
P.s.

Check the windows helpfile for the correct syntax. The every switch can take short weekdays as values so it will execute every Monday or whatever. But check your local documentation so you pick the right weekday abriviations ;)
Avatar of billy21

ASKER

<Monty Burns Voice>
Excelent
</Monty Burns Voice>
Avatar of billy21

ASKER

I've run into a problem with this.  Sure I can create a new job using the AT command but I can't programatically check whether or not a job already exists.  I'm likely to end up with multiple jobs as a result.