#!/usr/bin/perl -w # # mngsvr.pl # A cgi script to help with process management on development servers. # NOT RECOMMENDED FOR INSTALLATION ON A PRODUCTION SERVER # # This script and it counterpart, dirmon.pl, should not be used on an open server. # The server should be secured by at least IP and User restrictions. Possibilities for # user restrictions: For IIS, use NT username integration, for Netscape, use LDAP. # # amonotod June 2000 # amonotod@netscape.net # # This script is distributed "as is". No warranty of any kind is # expressed or implied. You use at your own risk. The author # will not be liable for data loss, damages, loss of profits or # any other kind of loss while using or misusing this software. use strict; no strict 'vars'; no strict 'refs'; my @snd2s = ("AdminSta1", "AdminSta2", "AdminSta3", "DevGuy1", "DevGuy2"); #Computer names to send messages to my $actndir = "c:/winnt/system32/jobcntrl"; my %choices = ( "A", ["Restart Web Server", "rstnetscape", "The Web service on SERVER will be restarted in 30 seconds.", "The Web service on SERVER has been restarted."], "B", ["Shutdown Web Server and restart in 10 minutes", "netscape", "The Web service on SERVER will be shutdown in 30 seconds. It will restart in 10 minutes.", "The Web service on SERVER has been restarted."], "C", ["Restart ColdFusion and Web Servers", "cf", "The ColdFusion and Web services on SERVER will be shutdown in 30 seconds.", "The Coldfusion and Web services on SERVER have been restarted."], "D", ["Stop ColdFusion Server", "cfstop", "The ColdFusion service on SERVER will be shutdown in 30 seconds.", "The Coldfusion service on SERVER has been shutdown."], "E", ["Start ColdFusion Server", "cfstart", "The ColdFusion service on SERVER will be restarted in 30 seconds.", "The Coldfusion service on SERVER has been restarted."], "F", ["Restart ColdFusion and SQL Servers", "sql", "The SQL and ColdFusion services on SERVER will be shutdown in 30 seconds.", "The SQL and Coldfusion services on SERVER have been restarted."], "G", ["Restart All the Above but not NT", "rstall", "All services on SERVER will be shutdown in 30 seconds.", "The services on SERVER have been restarted."], "H", ["Restart the Entire Server", "nt", "SERVER will be shutdown and restarted in 30 seconds."] ); # %choices= ("X", ["Description", "name", "The XXX service on Server will be restarted in 30 seconds.", "The XXX service on SERVER has been restarted."]) # For each entry above, you'll have an entry below. #@arrayname = (waittime, "stop command", "start command", "parameter", "parameter",...) @rstnetscape = (5, "net stop /y", "net start", "Netscape Enterprise Server 3.6"); @netscape = (600, "net stop /y", "net start", "Netscape Enterprise Server 3.6"); @cf = (5, "net stop /y", "net start", "Netscape Enterprise Server 3.6 ", "Cold Fusion Application Server", "Cold Fusion Executive"); @cfstop = (5, "net stop /y", "quit", "Cold Fusion Application Server", "Cold Fusion Executive"); @cfstart = (5, "net start", "quit", "Cold Fusion Executive", "Cold Fusion Application Server"); @sql = (5, "net stop /y", "net start", "Cold Fusion Application Server", "Cold Fusion Executive", "MSDTC", "SQLServerAgent", "MSSQLServer"); @rstall = (5, "net stop /y", "net start", "Netscape Enterprise Server 3.6 ", "Cold Fusion Application Server", "Cold Fusion Executive", "MSDTC", "SQLServerAgent", "MSSQLServer"); @nt = (0, "shutdown /l /r /y /c", "quit", ""); chdir "c:/"; if ((lc $ARGV[0]) eq "svcs") { #print "Doing services\n"; $cmdparam = uc $ARGV[1]; $cmdparam =~ s /\,//; #print "$cmdparam \n"; &dwnmsg; sleep 30; &do_cmd; sleep 5; &upmsg; } else { &html_content; if ($FORM{mng}) { &log_cmd; &open_html; &submit_reply; &close_html; } elsif ($FORM{confirm}) { &open_html; &print_reply; &confirm; &close_html; } else { &open_html; &print_query; &close_html; } } exit; sub print_query { print '