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.
#!C:/Perl64/bin/perl.exe print "Content-type: text/plain\n\n"; exec('C:\file.exe');
I'm not sure what language I should be using or if there are completely other, better ways of achieving my goal. Thanks!
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
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.