Skip to content
This repository
Browse code

(Bug 4651) Don't hardcode the location of workers.conf

This allows us to easily have a personal etc/workers.conf configuration.
  • Loading branch information...
commit 379063b71fed505cb4ae3786115d83eb2777ffc1 1 parent 29dcce1
Afuna afuna authored

Showing 1 changed file with 9 additions and 3 deletions. Show diff stats Hide diff stats

  1. +9 3 bin/worker-manager
12 bin/worker-manager
@@ -13,6 +13,9 @@ use strict;
13 13 use POSIX qw/ :sys_wait_h /;
14 14 use YAML;
15 15
  16 +BEGIN { require "$ENV{LJHOME}/cgi-bin/ljlib.pl"; }
  17 +use LJ::Directories;
  18 +
16 19 # daemonize ourselves unless debugging
17 20 my $debug = $ARGV[0] eq '--debug' ? 1 : 0;
18 21 daemonize() unless $debug;
@@ -21,8 +24,9 @@ daemonize() unless $debug;
21 24 use sigtrap handler => \&terminate, qw/ INT ABRT QUIT TERM /;
22 25
23 26 # now get config
24   -my $want = load_config()
25   - or die "no jobs configured in $ENV{LJHOME}/etc/workers.conf\n";
  27 +my $config_file;
  28 +my $want = load_config( \$config_file )
  29 + or die $config_file ? "no jobs configured in $config_file\n" : "could not find an etc/workers.conf file";
26 30
27 31 # main loop is pretty simple, reap and spawn
28 32 my ( %have, %kids );
@@ -38,8 +42,10 @@ while (1) {
38 42
39 43 sub load_config {
40 44 print "load_config()\n" if $debug;
  45 + my $config_file_ref = $_[0];
41 46
42   - my $fn = "$ENV{LJHOME}/etc/workers.conf";
  47 + my $fn = LJ::resolve_file( "etc/workers.conf" );
  48 + $$config_file_ref = $fn;
43 49 return unless -e $fn;
44 50
45 51 my $conf = YAML::LoadFile( $fn )

0 comments on commit 379063b

Please sign in to comment.
Something went wrong with that request. Please try again.