Legend:
- Unmodified
- Added
- Removed
-
trunk/cpanfile
r92 r102 10 10 # web application 11 11 requires 'Plack', '1.0036'; 12 requires 'Starman'; 13 requires 'File::Pid'; 12 14 13 15 # for opening the dbh handle -
trunk/start
r96 r102 9 9 use Plack::Runner; 10 10 use BookmarksApp; 11 use File::Spec::Functions qw{catfile}; 11 12 12 13 GetOptions( … … 19 20 my $app = BookmarksApp->new({ config => $config })->to_app; 20 21 21 my $listen = ':' . ($config->{port} || 5000); 22 my $server_root = $config->{server_root} || '.'; 23 my $listen = ':' . ($config->{port} || 5000); 24 my $access_log = catfile($server_root, 'access'); 25 my $error_log = catfile($server_root, 'errors'); 26 my $pid_file = catfile($server_root, 'pid'); 22 27 23 28 my $runner = Plack::Runner->new(server => 'Starman'); 24 $runner->parse_options(qw{--listen}, $listen, qw{--daemonize --pid pid --error-log errors --access-log access}); 29 $runner->parse_options( 30 '--daemonize', 31 '--listen', $listen, 32 '--pid', $pid_file, 33 '--error-log', $error_log, 34 '--access-log', $access_log, 35 ); 25 36 $runner->run($app); -
trunk/stop
r65 r102 1 #!/bin/bash 1 #!/usr/bin/perl -w 2 use strict; 2 3 3 kill `cat pid` 4 use FindBin; 5 use lib "$FindBin::RealBin/lib"; 6 7 use Getopt::Long; 8 use YAML; 9 use File::Pid; 10 use File::Spec::Functions qw{catfile}; 11 12 GetOptions( 13 'file=s' => \my $CONFIG_FILE, 14 ); 15 16 $CONFIG_FILE ||= 'server.yml'; 17 -e $CONFIG_FILE or die "Config file $CONFIG_FILE not found\n"; 18 my $config = YAML::LoadFile($CONFIG_FILE); 19 20 my $server_root = $config->{server_root} || '.'; 21 22 my $pid_file = File::Pid->new({ 23 file => catfile($server_root, 'pid'), 24 }); 25 26 if (my $pid = $pid_file->running) { 27 kill 'TERM', $pid; 28 }
Note: See TracChangeset
for help on using the changeset viewer.