Remotely Executing an Independent .exe on an Apache Server [CGI]

Go To


I have an executable program I've created which is a server. I would like to be able to start and stop instances of this program on a Windows Server 2008 machine via the website the same machine hosts.

The functionality I'm hoping to achieve is: from anywhere I can access my website to start and stop instances of the server code instead of constantly Remote Desktop-ing into it just to start/stop it.

I've tried using Perl, but when I run the code it looks like it prints out some of the information the program does (so it's working) but then seems to stop. Whereas I would like it to start an instance of the program as its own process.


print "Content-type: text/plain\n\n";


I'm not sure what language I should be using or if there are completely other, better ways of achieving my goal. Thanks!

2012-04-03 19:44
by Sam F - Ωmega 2012-04-03 19:47
I appreciate the link, but I was hoping more of a response that was a little more analytic of the goals, in the terms that is Perl the correct method of trying to do what I was looking for?

As I mentioned, instead of using threads spawning a completely new process, and then killing the process if it's active.

Thanks - Sam F 2012-04-03 19:51

Threads are very hard to work with, believe me... To do it right and to understand it correctly, you need a lot of study about that. I know you don't like to hear that, but threads are really special part, not just anything else. Sorry if you hate me now :- - Ωmega 2012-04-03 19:55
Of course I don't hate you! :) But I'm very familiar with threads, the server I'm trying to manipulate here is very thread heavy. I'm just hesitant because all I'm trying to do is:

  1. Click a button that starts an .exe
  2. Allow another button to kill processes with that name on host

It just seems unnecessary and a lot of overkill to try and implement it with threading. (Though of course I could be wrong - Sam F 2012-04-03 19:59


exec is the wrong choice, and so are threads. Simply start the process in the background. You did not say how you would normally stop the server. If it has its own command for stopping, the same as for starting applies; else kill the process.

2012-04-03 21:31
by daxim
Seem's to be what I'm looking for, thanks - Sam F 2012-04-03 22:58