root/trunk/perlbal

Revision 687, 2.3 kB (checked in by jacques, 2 years ago)

Bump copyright and fixed typo in Interactive

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/usr/bin/perl -w
2#
3
4=head1 NAME
5
6Perlbal - Reverse-proxy load balancer and webserver
7
8=head1 DESCRIPTION
9
10For now, see example configuration files in conf/
11
12=head1 AUTHORS
13
14 Brad Fitzpatrick, <brad@danga.com>
15 Mark Smith, <marksmith@danga.com>
16
17=head1 SEE ALSO
18
19 http://www.danga.com/perlbal/
20
21=head1 COPYRIGHT AND LICENSE
22
23Copyright 2004, Danga Interactive, Inc.
24Copyright 2005-2007, Six Apart, Ltd.
25
26You can use and redistribute Perlbal under the same terms as Perl itself.
27
28=cut
29
30
31use strict;
32use warnings;
33use lib 'lib';
34use Perlbal;
35
36my $opt_daemonize;
37my $opt_config;
38my $opt_help;
39my $opt_version;
40usage(1) unless
41    Getopt::Long::GetOptions(
42                             'daemon'   => \$opt_daemonize,
43                             'config=s' => \$opt_config,
44                             'help'     => \$opt_help,
45                             'version'  => \$opt_version,
46               );
47
48my $default_config = "/etc/perlbal/perlbal.conf";
49$opt_config = $default_config if ! $opt_config && -e $default_config;
50
51usage(0) if $opt_help;
52
53sub usage {
54    my $rv = shift;
55    print STDERR <<USAGE;
56Usage: perlbal [OPTS]
57  --help           This usage info
58  --version        Print perlbal release version
59  --config=[file]  Specify Perlbal config file
60                   (default: /etc/perlbal/perlbal.conf)
61  --daemon         Daemonize
62USAGE
63
64    exit($rv);
65}
66
67if ($opt_version) {
68    print STDOUT "Perlbal version $Perlbal::VERSION\n";
69    exit 0;
70}
71
72# load user config
73if ($opt_config && ! Perlbal::load_config($opt_config, sub { print STDOUT "$_[0]\n"; })) {
74    die "Error starting up.\n";
75}
76
77# FIXME: warn harder if web_server services are enabled
78if ($Perlbal::AIO_MODE eq "none") {
79    print STDERR "WARNING:  AIO mode disabled or not available.  \n".
80                 "          Perlbal will run slowly under load if you're doing any\n".
81                 "          disk operations. (e.g. web_server mode).\n".
82                 "          Install IO::AIO for better performance.\n";
83}
84
85unless (Perlbal::Socket->WatchedSockets() > 0) {
86    die "No services or management port configured.  Nothing to do.  Stopping.\n";
87}
88
89if ($opt_daemonize) {
90    Perlbal::daemonize();
91} else {
92    print "Running.\n";
93}
94
95exit 0 if Perlbal::run();
96exit 1;
97
98# Local Variables:
99# mode: perl
100# c-basic-indent: 4
101# indent-tabs-mode: nil
102# End:
Note: See TracBrowser for help on using the browser.