27 lines
635 B
Perl
Executable File
27 lines
635 B
Perl
Executable File
#!/usr/bin/env perl
|
|
|
|
use strict;
|
|
use warnings FATAL => 'all';
|
|
use Path::Class 'file';
|
|
|
|
BEGIN {
|
|
eval "use Daemon::Control";
|
|
if ($@) {
|
|
exec(file($ENV{HOME}, 'bin', 'localenv'), $0, @ARGV);
|
|
}
|
|
}
|
|
|
|
use Path::Class;
|
|
my $log_dir = dir($ENV{HOME}, 'logs');
|
|
mkdir $log_dir if ! -d $log_dir;
|
|
|
|
my $program = file($ENV{HOME}, 'bin', 'netdisco-daemon-fg');
|
|
|
|
Daemon::Control->new({
|
|
name => 'Netdisco Daemon',
|
|
program => ($ENV{NETDISCO_DAEMON} || $program),
|
|
pid_file => file($ENV{HOME}, 'netdisco-daemon.pid'),
|
|
stderr_file => file($log_dir, 'netdisco-daemon.log'),
|
|
stdout_file => file($log_dir, 'netdisco-daemon.log'),
|
|
})->run;
|