开发者

How to schedule a task,remote access and re-run of an executable

He is my dilemma, I hope someone out there has done this… Any views or Ideas are welcome. I am new to this are so be gentle..

I have PC A that needs to have a programX (.exe) running on a regular basis every 2 Mins this checks for another file and process t开发者_开发问答he file if present.

On PC B I need to be able to stop and start the program as and when on PC A remotely. Also programX is not allowed to re-run/recheck the existence of the file until the old programX has finished.

Both PCs are running Windows 7. (This will also be used on a couple of XP machines.)

Question 1

How do I get the .exe to run every 2 Mins? (Task scheduler only does once daily and I don’t want to have 576 tasks)

Question 1.1

How do I get the .exe to start and stop remotely?

Question 1.2

How do I get the system to recognise that programX is already running and not finished?


Question 1:
I think you'd better write a service (always active) that runs a method programmatically using (for example) a timer.
Question 1.1:
If app on PC A exposes a class via remoting, from PC B you can run a Start() and Stop() method directly on PC A.
Using remoting you can create a main app (called server) which exposes a class (usually using interfaces) that can be accessed remotely via TCP/UDP/Pipes from localhost or internet.
Take a look at this example: this is only the first I've found searching "C# remoting example" in Google, but you can find hundreds.
For your need, service on PC A (see question 1) could expose via remoting a class that can start/stop the other application you run on PC A.

Question 1.2:
On PC A you could use a mutex (for example)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜