| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | mojomojo_fastcgi_manage.pl - script to start/stop/restart mojomojo fastcgi instance | ||
| 6 | |||
| 7 | =cut | ||
| 8 | |||
| 9 | eval { use FCGI::Engine::Manager }; | ||
| 10 | if ($@) { die "You need to install FCGI::Engine to run this script\n"; } | ||
| 11 | |||
| 12 | my $m = | ||
| 13 | FCGI::Engine::Manager->new( conf => 'script/mojomojo_fastcgi_manage.yml' ); | ||
| 14 | |||
| 15 | my ( $command, $server_name ) = @ARGV; | ||
| 16 | $m->start($server_name) if $command eq 'start'; | ||
| 17 | $m->stop($server_name) if $command eq 'stop'; | ||
| 18 | $m->restart($server_name) if $command eq 'restart'; | ||
| 19 | $m->graceful($server_name) if $command eq 'graceful'; | ||
| 20 | print $m->status($server_name) if $command eq 'status'; | ||
| 21 | |||
| 22 | =head1 USAGE | ||
| 23 | |||
| 24 | NOTE: Run this script from the parent directory so path to configuration is correct. | ||
| 25 | |||
| 26 | perl script/mojomojo_fastcgi_manage.pl start | ||
| 27 | perl script/mojomojo_fastcgi_manage.pl stop | ||
| 28 | perl script/mojomojo_fastcgi_manage.pl restart mojomojo.server | ||
| 29 | |||
| 30 | |||
| 31 | =head1 Web Server Configuration | ||
| 32 | |||
| 33 | =head2 Apache | ||
| 34 | |||
| 35 | In an apache conf file: | ||
| 36 | |||
| 37 | FastCgiExternalServer /tmp/mojomojo.fcgi -socket /tmp/mojomojo.socket | ||
| 38 | Alias /wiki /tmp/mojomojo.fcgi/ |