Advertisement
Guest User

localhost/foswiki

a guest
Mar 31st, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. # Foswiki - The Free and Open Source Wiki, http://foswiki.org/
  3. #
  4. # Copyright (C) 2008-2017 Gilmar Santos Jr, jgasjr@gmail.com and Foswiki
  5. # contributors. Foswiki contributors are listed in the AUTHORS file in the root
  6. # of Foswiki distribution.
  7. #
  8. # This script is based/inspired on Catalyst framework. Refer to
  9. #
  10. # http://search.cpan.org/author/MRAMBERG/Catalyst-Runtime-5.7010/lib/Catalyst.pm
  11. #
  12. # For credits and liscence details.
  13. #
  14. # This program is free software; you can redistribute it and/or
  15. # modify it under the terms of the GNU General Public License
  16. # as published by the Free Software Foundation; either version 2
  17. # of the License, or (at your option) any later version. For
  18. # more details read LICENSE in the root of this distribution.
  19. #
  20. # This program is distributed in the hope that it will be useful,
  21. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  23. #
  24. # As per the GPL, removal of this notice is prohibited.
  25.  
  26. use strict;
  27. use warnings;
  28.  
  29. BEGIN {
  30. $Foswiki::cfg{Engine} = 'Foswiki::Engine::FastCGI';
  31. @INC = ( '.', grep { $_ ne '.' } @INC );
  32. delete $ENV{FOSWIKI_ACTION} if exists $ENV{FOSWIKI_ACTION};
  33. require 'setlib.cfg';
  34. }
  35.  
  36. use Getopt::Long;
  37. use Pod::Usage;
  38. use Foswiki;
  39. use Foswiki::UI;
  40. use Cwd;
  41.  
  42. our ($script) = $0 =~ /^(.*)$/;
  43. our ($dir) = Cwd::cwd() =~ /^(.*)$/;
  44.  
  45. my @argv = @ARGV;
  46.  
  47. my (
  48. $listen, $nproc, $max, $size, $check, $pidfile,
  49. $manager, $detach, $help, $quiet
  50. );
  51.  
  52. my $pname = 'foswiki'; # Default process name.
  53.  
  54. GetOptions(
  55. 'listen|l=s' => \$listen,
  56. 'nproc|n=i' => \$nproc,
  57. 'max|x=i' => \$max,
  58. 'check|c=i' => \$check,
  59. 'size|s=i' => \$size,
  60. 'pidfile|p=s' => \$pidfile,
  61. 'manager|M=s' => \$manager,
  62. 'daemon|d' => \$detach,
  63. 'help|?' => \$help,
  64. 'quiet|q' => \$quiet,
  65. 'pname|a=s' => \$pname,
  66. );
  67.  
  68. pod2usage(1) if $help;
  69.  
  70. # untaint
  71. if ( defined $pidfile ) {
  72. $pidfile =~ /^(.*)$/ and $pidfile = $1;
  73. }
  74.  
  75. @ARGV = @argv;
  76. undef @argv;
  77.  
  78. $Foswiki::engine->run(
  79. $listen,
  80. {
  81. nproc => $nproc,
  82. pidfile => $pidfile,
  83. manager => $manager,
  84. detach => $detach,
  85. quiet => $quiet,
  86. max => $max,
  87. size => $size,
  88. check => $check,
  89. pname => $pname,
  90. }
  91. );
  92.  
  93. __END__
  94.  
  95. =head1 SYNOPSIS
  96.  
  97. foswiki.fcgi [options]
  98.  
  99. Options:
  100. -l --listen Socket to listen on
  101. -n --nproc Number of backends to use, defaults to 1
  102. -p --pidfile File used to write pid to
  103. -M --manager FCGI manager class
  104. -x --max Maximum requests served per server instance
  105. -c --check Number of requests when to check the size of the server
  106. -s --size Maximum memory size of a server before being recycled
  107. -d --daemon Detach from terminal and keeps running as a daemon
  108. -q --quiet Disable notification messages
  109. -? --help Display this help and exits
  110. -N --pname Process name to display in ps output for the process-manager task.
  111.  
  112. Note:
  113. FCGI manager class defaults to Foswiki::Engine::FastCGI::ProcManager, a
  114. wrapper around FCGI::ProcManager to enable automatic reload of
  115. configurations if changed. If you provide another class, probably you'll
  116. need to restart FastCGI processes manually.
  117.  
  118. =cut
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement