| Last change
                  on this file since 103 was
                  103,
                  checked in by peter, 10 years ago | 
        
          | moved scripts into the bin directory
combined start and stop in bkmkd
 | 
        
          | 
              
                  Property svn:executable set to
                  * | 
        | File size:
            543 bytes | 
      
      
        
  | Line |  | 
|---|
| 1 | #!/usr/bin/perl -w | 
|---|
| 2 | use strict; | 
|---|
| 3 |  | 
|---|
| 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 
TracBrowser
        for help on using the repository browser.