Squashed commit of the following: commit 6ca234759e27bb7e9e598eaf468d4ea6a0043867 Author: Oliver Gorwits <oliver@cpan.org> Date: Tue Jun 11 13:38:19 2013 +0100 version bump commit c90ce039899b9a07e2ad833c753d0805e68d8bef Author: Oliver Gorwits <oliver@cpan.org> Date: Tue Jun 11 13:29:11 2013 +0100 better discovery of localenv status
		
			
				
	
	
		
			57 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Perl
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Perl
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env perl
 | |
| 
 | |
| use strict;
 | |
| use warnings FATAL => 'all';
 | |
| 
 | |
| our $home;
 | |
| 
 | |
| BEGIN {
 | |
|   # try to find a localenv if one isn't already in place.
 | |
|   $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
 | |
| 
 | |
|   if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
 | |
|       use File::Spec;
 | |
|       my $localenv = File::Spec->catfile($FindBin::RealBin, 'localenv');
 | |
|       exec($localenv, $0, @ARGV) if -f $localenv;
 | |
|       $localenv = File::Spec->catfile($home, 'perl5', 'bin', 'localenv');
 | |
|       exec($localenv, $0, @ARGV) if -f $localenv;
 | |
|       die "Sorry, can't find libs required for App::Netdisco.\n";
 | |
|   }
 | |
| }
 | |
| 
 | |
| use FindBin;
 | |
| FindBin::again();
 | |
| use Path::Class;
 | |
| use Daemon::Control;
 | |
| 
 | |
| my $netdisco = file($FindBin::RealBin, 'netdisco-web-fg');
 | |
| my @args = (scalar @ARGV > 1 ? @ARGV[1 .. $#ARGV] : ());
 | |
| 
 | |
| my $log_dir = dir($home, 'logs');
 | |
| mkdir $log_dir if ! -d $log_dir;
 | |
| 
 | |
| Daemon::Control->new({
 | |
|   name => 'Netdisco Web',
 | |
|   program  => 'starman',
 | |
|   program_args => ['--disable-keepalive', @args, $netdisco->stringify],
 | |
|   pid_file => file($home, 'netdisco-web.pid'),
 | |
|   stderr_file => file($log_dir, 'netdisco-web.log'),
 | |
|   stdout_file => file($log_dir, 'netdisco-web.log'),
 | |
| })->run;
 | |
| 
 | |
| =head1 NAME
 | |
| 
 | |
| netdisco-web - Web Application Server for Netdisco
 | |
| 
 | |
| =head1 SEE ALSO
 | |
| 
 | |
| =over 4
 | |
| 
 | |
| =item *
 | |
| 
 | |
| L<App::Netdisco>
 | |
| 
 | |
| =back
 | |
| 
 | |
| =cut
 |