[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 #!/opt/perl/bin/perl 2 3 eval 'exec /opt/perl/bin/perl -S $0 $1+"$@"}' 4 if 0; # not running under some shell 5 6 use strict; 7 8 my $VERSION = sprintf("1.%06d", q$Revision: 10720 $ =~ /(\d+)/o); 9 10 my $arg_test = shift(@ARGV) if $ARGV[0] eq '--test'; 11 $ENV{DBI_TRACE} = shift(@ARGV) || 2 if $ARGV[0] =~ s/^--dbitrace=?//; 12 13 require DBI::ProxyServer; 14 15 # XXX these should probably be moved into DBI::ProxyServer 16 delete $ENV{IFS}; 17 delete $ENV{CDPATH}; 18 delete $ENV{ENV}; 19 delete $ENV{BASH_ENV}; 20 21 if ($arg_test) { 22 require RPC::PlServer::Test; 23 @DBI::ProxyServer::ISA = qw(RPC::PlServer::Test DBI); 24 } 25 26 DBI::ProxyServer::main(@ARGV); 27 28 exit(0); 29 30 31 __END__ 32 33 =head1 NAME 34 35 dbiproxy - A proxy server for the DBD::Proxy driver 36 37 =head1 SYNOPSIS 38 39 dbiproxy <options> --localport=<port> 40 41 42 =head1 DESCRIPTION 43 44 This tool is just a front end for the DBI::ProxyServer package. All it 45 does is picking options from the command line and calling 46 DBI::ProxyServer::main(). See L<DBI::ProxyServer> for details. 47 48 Available options include: 49 50 =over 4 51 52 =item B<--chroot=dir> 53 54 (UNIX only) After doing a bind(), change root directory to the given 55 directory by doing a chroot(). This is useful for security, but it 56 restricts the environment a lot. For example, you need to load DBI 57 drivers in the config file or you have to create hard links to Unix 58 sockets, if your drivers are using them. For example, with MySQL, a 59 config file might contain the following lines: 60 61 my $rootdir = '/var/dbiproxy'; 62 my $unixsockdir = '/tmp'; 63 my $unixsockfile = 'mysql.sock'; 64 foreach $dir ($rootdir, "$rootdir$unixsockdir") { 65 mkdir 0755, $dir; 66 } 67 link("$unixsockdir/$unixsockfile", 68 "$rootdir$unixsockdir/$unixsockfile"); 69 require DBD::mysql; 70 71 { 72 'chroot' => $rootdir, 73 ... 74 } 75 76 If you don't know chroot(), think of an FTP server where you can see a 77 certain directory tree only after logging in. See also the --group and 78 --user options. 79 80 =item B<--configfile=file> 81 82 Config files are assumed to return a single hash ref that overrides the 83 arguments of the new method. However, command line arguments in turn take 84 precedence over the config file. See the "CONFIGURATION FILE" section 85 in the L<DBI::ProxyServer> documentation for details on the config file. 86 87 =item B<--debug> 88 89 Turn debugging mode on. Mainly this asserts that logging messages of 90 level "debug" are created. 91 92 =item B<--facility=mode> 93 94 (UNIX only) Facility to use for L<Sys::Syslog>. The default is 95 B<daemon>. 96 97 =item B<--group=gid> 98 99 After doing a bind(), change the real and effective GID to the given. 100 This is useful, if you want your server to bind to a privileged port 101 (<1024), but don't want the server to execute as root. See also 102 the --user option. 103 104 GID's can be passed as group names or numeric values. 105 106 =item B<--localaddr=ip> 107 108 By default a daemon is listening to any IP number that a machine 109 has. This attribute allows to restrict the server to the given 110 IP number. 111 112 =item B<--localport=port> 113 114 This attribute sets the port on which the daemon is listening. It 115 must be given somehow, as there's no default. 116 117 =item B<--logfile=file> 118 119 Be default logging messages will be written to the syslog (Unix) or 120 to the event log (Windows NT). On other operating systems you need to 121 specify a log file. The special value "STDERR" forces logging to 122 stderr. See L<Net::Daemon::Log> for details. 123 124 =item B<--mode=modename> 125 126 The server can run in three different modes, depending on the environment. 127 128 If you are running Perl 5.005 and did compile it for threads, then the 129 server will create a new thread for each connection. The thread will 130 execute the server's Run() method and then terminate. This mode is the 131 default, you can force it with "--mode=threads". 132 133 If threads are not available, but you have a working fork(), then the 134 server will behave similar by creating a new process for each connection. 135 This mode will be used automatically in the absence of threads or if 136 you use the "--mode=fork" option. 137 138 Finally there's a single-connection mode: If the server has accepted a 139 connection, he will enter the Run() method. No other connections are 140 accepted until the Run() method returns (if the client disconnects). 141 This operation mode is useful if you have neither threads nor fork(), 142 for example on the Macintosh. For debugging purposes you can force this 143 mode with "--mode=single". 144 145 =item B<--pidfile=file> 146 147 (UNIX only) If this option is present, a PID file will be created at the 148 given location. Default is to not create a pidfile. 149 150 =item B<--user=uid> 151 152 After doing a bind(), change the real and effective UID to the given. 153 This is useful, if you want your server to bind to a privileged port 154 (<1024), but don't want the server to execute as root. See also 155 the --group and the --chroot options. 156 157 UID's can be passed as group names or numeric values. 158 159 =item B<--version> 160 161 Supresses startup of the server; instead the version string will 162 be printed and the program exits immediately. 163 164 =back 165 166 167 =head1 AUTHOR 168 169 Copyright (c) 1997 Jochen Wiedmann 170 Am Eisteich 9 171 72555 Metzingen 172 Germany 173 174 Email: joe@ispsoft.de 175 Phone: +49 7123 14881 176 177 The DBI::ProxyServer module is free software; you can redistribute it 178 and/or modify it under the same terms as Perl itself. In particular 179 permission is granted to Tim Bunce for distributing this as a part of 180 the DBI. 181 182 183 =head1 SEE ALSO 184 185 L<DBI::ProxyServer>, L<DBD::Proxy>, L<DBI> 186 187 =cut
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |