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.
61 use lib "$FindBin::Bin/lib", "$FindBin::Bin/../lib";
68 my $VERSION = '$Revision: 1.11 $';
69 ($VERSION) = ($VERSION =~ /\$Revision: (.*) /);
71 my $pidfile = "$Clearexec::CLEAROPTS{CLEAREXEC_RUNDIR}/$FindBin::Script.pid";
73 # Augment PATH with $Clearadm::CLEAROPTS{CLEARADM_BASE}
74 $ENV{PATH} .= ":$Clearadm::CLEAROPTS{CLEARADM_BASE}";
79 my $multithreaded = $Clearexec::CLEAROPTS{CLEAREXEC_MULTITHREADED};
83 'usage' => sub { Usage },
84 'verbose' => sub { set_verbose },
85 'debug' => sub { set_debug },
86 'daemon!' => \$daemon,
87 'multithreaded!' => \$multithreaded,
88 'pidfile=s' => \$pidfile,
89 ) or Usage "Invalid parameter";
91 Usage 'Extraneous options: ' . join ' ', @ARGV
94 $clearexec = Clearexec->new;
96 $clearexec->setMultithreaded ($multithreaded);
98 my $logfile = "$Clearexec::CLEAROPTS{CLEAREXEC_LOGDIR}/$FindBin::Script.log";
100 EnterDaemonMode $logfile, $logfile, $pidfile
103 display "$FindBin::Script V$VERSION started at " . localtime;
105 $clearexec->startServer;
107 verbose "Server running";
111 =head1 CONFIGURATION AND ENVIRONMENT
113 DEBUG: If set then $debug is set to this level.
115 VERBOSE: If set then $verbose is set to this level.
117 TRACE: If set then $trace is set to this level.
125 L<Getopt::Long|Getopt::Long>
127 =head2 ClearSCM Perl Modules
140 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/Clearexec.pm">Clearexec</a><br>
141 <a href="http://clearscm.com/php/scm_man.php?file=lib/Display.pm">Display</a><br>
142 <a href="http://clearscm.com/php/scm_man.php?file=lib/Utils.pm">Utils</a><br>
147 =head1 BUGS AND LIMITATIONS
149 There are no known bugs in this script
151 Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.
153 =head1 LICENSE AND COPYRIGHT
155 Copyright (c) 2010, ClearSCM, Inc. All rights reserved.