All pastes #340369 Raw Edit

Something

public text v1 · immutable
·published 2007-02-04 19:01 UTC
rendered paste body
#!/usr/bin/env perl
# admin.pl
#
# A simple configure script to configure this server
#
############################################################              
use Term::ANSIColor qw(:constants);
my $version = "0.0.1a";

############################################################              
# Some people try to run this as a CGI. That's wrong!
############################################################              
if ( defined( $ENV{'PATH_INFO'} )
    || defined( $ENV{'QUERY_STRING'} )
    || defined( $ENV{'REQUEST_METHOD'} ) ) {
    print "Content-Type: text/html\n\n";
    print "You must run this script from the command line.";
    exit;
    }

use Cwd;
$dir = cwd();

############################################################
# VARIABLES  
############################################################
my $config_use_color = 1;
my $menu = 0;
my $command = 0;
my $loc_hostame = `uname -n`;

####################################################################################

    while ( ( $command ne "q" ) && ( $command ne "Q" ) ) {
    clear_screen();
    print BOLD, BLUE, "ws1.angletonpd.net Administration Tool ";
    print "$version\n", RESET;
    print "---------------------------------------------------------\n";

    if ( $menu == 0 ) {
        print "Main Menu ++\n";
        print "1.  Learn Spam and Clear it\n";
        print "2.  Backup the server\n";
        print "3.  View logging for qmail-smtpd\n";
	print "q   Quit this script\n";
        print "\n";

	print "Make a selection: ";
	$command = <STDIN>;

        if ( $command eq "1" ) {
	command1();
	} if ( $command eq "q" ) {
	exit;
	}
    }
}


sub clear_screen() {
    if ( $^O =~ /^mswin/i) {
        system "cls";
    } else {
        system "clear";
    }
}

sub command1 {
	print BOLD, BLUE, "ToDo: Code for command1", RESET;
}