[Rt-commit] r11986 - in rt/branches/3.8-TESTING: bin

jesse at bestpractical.com jesse at bestpractical.com
Wed Apr 30 21:22:28 EDT 2008


Author: jesse
Date: Wed Apr 30 21:22:27 2008
New Revision: 11986

Modified:
   rt/branches/3.8-TESTING/   (props changed)
   rt/branches/3.8-TESTING/bin/standalone_httpd.in

Log:
 r30292 at 31b:  jesse | 2008-04-30 20:49:41 -0400
 * cope with standalone trying to bind to port 80 and failing 


Modified: rt/branches/3.8-TESTING/bin/standalone_httpd.in
==============================================================================
--- rt/branches/3.8-TESTING/bin/standalone_httpd.in	(original)
+++ rt/branches/3.8-TESTING/bin/standalone_httpd.in	Wed Apr 30 21:22:27 2008
@@ -105,5 +105,21 @@
 require RT::Interface::Web::Standalone;
 my $server = RT::Interface::Web::Standalone->new;
 $server->port($port);
-$server->run();
+eval { $server->run() };
+
+if (my $err = $@) {
+   if ($err =~ /bind: Permission denied/ && $port <= 1024) {
+        print STDERR <<EOF;
+
+RT couldn't start up a web server on port @{[$port]}. This is often the case 
+if you're running @{[$0]} as someone other than your system's "root" user.  
+For now, RT has picked a random alternate port to run on.
+
+EOF
+        $server->port( 8000 + int(rand(1024))) ;
+        $server->run;
+   } else {
+        die $err;
+   }
+}
 


More information about the Rt-commit mailing list