5 =head1 NAME $RCSfile: clearagent.pl,v $
7 Daemon process to run commands on current host in response to requests from
16 Andrew DeFaria <Andrew@ClearSCM.com>
24 Mon Dec 13 09:13:27 EST 2010
28 $Date: 2011/02/02 18:43:53 $
34 Usage clearagent.pl: [-u|sage] [-ve|rbose] [-deb|ug]
37 -u|sage: Displays usage
40 -de|bug: Output debug messages
42 -da|emon: Run in daemon mode (Default)
43 -m|ultithreaded: Multithread requests (Default)
44 -p|idfile: File to be created with the pid written to it (Default:
45 clearagent.pid). Note: pidfile is only written if -daemon
50 This script normally runs as a daemon and accepts requests from other hosts to
51 execute commands locally and send back the results.
62 use lib "$FindBin::Bin/lib", "$FindBin::Bin/../lib";
69 my $VERSION = '$Revision: 1.11 $';
70 ($VERSION) = ($VERSION =~ /\$Revision: (.*) /);
72 my $pidfile = "$Clearexec::CLEAROPTS{CLEAREXEC_RUNDIR}/$FindBin::Script.pid";
74 # Augment PATH with $Clearadm::CLEAROPTS{CLEARADM_BASE}
75 $ENV{PATH} .= ":$Clearadm::CLEAROPTS{CLEARADM_BASE}";
80 my $multithreaded = $Clearexec::CLEAROPTS{CLEAREXEC_MULTITHREADED};
84 'usage' => sub { Usage },
85 'verbose' => sub { set_verbose },
86 'debug' => sub { set_debug },
87 'daemon!' => \$daemon,
88 'multithreaded!' => \$multithreaded,
89 'pidfile=s' => \$pidfile,
90 ) or Usage "Invalid parameter";
92 Usage 'Extraneous options: ' . join ' ', @ARGV
95 $clearexec = Clearexec->new;
97 $clearexec->setMultithreaded ($multithreaded);
99 my $logfile = "$Clearexec::CLEAROPTS{CLEAREXEC_LOGDIR}/$FindBin::Script";
100 $logfile =~ s/\.pl$//;
101 $logfile .= '.' . hostname() . '.log';
103 EnterDaemonMode $logfile, $logfile, $pidfile
106 display "$FindBin::Script V$VERSION started at " . localtime;
108 $clearexec->startServer;
110 verbose "Server running";
114 =head1 CONFIGURATION AND ENVIRONMENT
116 DEBUG: If set then $debug is set to this level.
118 VERBOSE: If set then $verbose is set to this level.
120 TRACE: If set then $trace is set to this level.
128 L<Getopt::Long|Getopt::Long>
130 =head2 ClearSCM Perl Modules
143 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/Clearexec.pm">Clearexec</a><br>
144 <a href="http://clearscm.com/php/scm_man.php?file=lib/Display.pm">Display</a><br>
145 <a href="http://clearscm.com/php/scm_man.php?file=lib/Utils.pm">Utils</a><br>
150 =head1 BUGS AND LIMITATIONS
152 There are no known bugs in this script
154 Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.
156 =head1 LICENSE AND COPYRIGHT
158 Copyright (c) 2010, ClearSCM, Inc. All rights reserved.