Server Management

Here's my sample code for remotely managing a WinNT-based development web server, written specifically for allowing developers to shutdown services. Please keep in mind that this is only a code example, and while it does work on my site, there is no warranty implied, nor do I endorse this code as being fit for merchantability for any purpose. 

USE THIS CODE AT YOUR OWN RISK!

If you are going to use this on your server, you will have to manually configure the scripts for your directory structure. Also be sure to create any directories which are in the script, but do not already exist on your system. The mngsvr.pl can be run as whatever user your webserver runs as, but needs to have write access to your "Jobs" directory. The dirmon.pl MUST run as system, or as an administrative account, which is why I say not to use it on production servers (I haven't tried to hack it, but I assume it is possible, since I did not do any char-parsing routine to kill pipes or backticks or other crap.).

dirmon.pl
This script loads as a service, and watches your "Jobs" directory for a file to be created. If the file is named correctly, the script will parse the file, log some info from the file, run the command contained therein, and delete the file.

mngsvr.pl
This script works as a web interface to the process manager, and actually contains all the configuration info for the services to be managed. Users access this a web menu, having to submit and confirm the choice made. The script creates a file in the "Jobs" directory, containing some user info and some command info. The dirmon service picks up the file, and uses the info to actually call this script as a local script, which executes and carries out the desired task.

Care to email me? amonotod@netsape.net
1